Skip to content

Commit

Permalink
fix: default swiftlint.path value is invalid on Windows #67
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Aug 11, 2023
1 parent 6fc8b56 commit ed3b7a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.8.4-beta.0

- fix: default swiftlint.path value is invalid on Windows #67

## 1.8.1

- fix: improved error message when SwiftLint is not installed #56 #57
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/vknabel/vscode-swiftlint"
},
"version": "1.8.3",
"version": "1.8.4-beta.0",
"license": "MIT",
"author": {
"name": "Valentin Knabel",
Expand Down
7 changes: 5 additions & 2 deletions src/Current.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,13 @@ export function prodEnvironment(): Current {
}

const fallbackGlobalSwiftFormatPath = (): string[] => {
const defaultPath = ["/usr/bin/env", "swiftlint"];
let defaultPath = ["/usr/bin/env", "swiftlint"];
if (os.platform() === "win32") {
defaultPath = ["swiftlint"];
}
const path = vscode.workspace
.getConfiguration()
.get("swiftlint.path", defaultPath);
.get<string | string[] | null>("swiftlint.path", null);
if (typeof path === "string") {
return [absolutePath(path)];
} else if (Array.isArray(path) && path.length > 0) {
Expand Down

0 comments on commit ed3b7a4

Please sign in to comment.