Skip to content

Commit

Permalink
Use ~ for home path
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketho committed Aug 10, 2024
1 parent 3e8e15c commit 73aa4f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## [0.16.3] - 2024-08-10
## [0.16.4] - 2024-08-10
- 0.16.4: Apparently `~` works fine as home path on Windows too
- 0.16.3: 🍎 Fixed library paths for macOS
- 0.16.2: 🐧 Fixed library paths for Linux
- 0.16.1: 🙇 Fixed the default for `wowAPI.luals.configurationScope` back to Workspace
Expand Down Expand Up @@ -123,6 +124,7 @@ To avoid loading for Lua projects not related to World of Warcraft, all settings
- PR [#123](https://github.com/Ketho/vscode-wow-api/pull/123) Make childGroups optional in AceConfig.OptionsTable
- PR [#120](https://github.com/Ketho/vscode-wow-api/pull/120) Add definition for tostringall()

[0.16.4]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.16.4
[0.16.3]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.16.3
[0.16.2]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.16.2
[0.16.1]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.16.1
Expand Down
17 changes: 2 additions & 15 deletions src/luals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,13 @@ export function removeDeprecatedGlobals() {
}
}

function anonymizePath(s: string) {
const platform = process.platform;
const pos = s.indexOf(".vscode"); // should also work for .vscode-insiders
if (platform === "win32") {
return path.join("$USERPROFILE", s.substring(pos), "Annotations");
}
else if (platform === "linux" || platform === "darwin") {
return path.join("~", s.substring(pos), "Annotations");
}
else {
return path.join(s, "Annotations");
}
}

// add wow-api path to luals
export function setWowLibrary(context: vscode.ExtensionContext): Thenable<void> {
const extension = vscode.extensions.getExtension("ketho.wow-api")!;
let folderPath;
if (context.extensionMode === vscode.ExtensionMode.Production) {
folderPath = anonymizePath(extension.extensionPath);
const pos = extension.extensionPath.indexOf(".vscode"); // should also work for .vscode-insiders
folderPath = path.join("~", extension.extensionPath.substring(pos), "Annotations");
}
else {
folderPath = path.join(extension.extensionPath, "Annotations");
Expand Down

0 comments on commit 73aa4f1

Please sign in to comment.