From 73aa4f1b9043d24d780b4949f624f36b87ee0662 Mon Sep 17 00:00:00 2001 From: Ketho Date: Sat, 10 Aug 2024 05:10:52 +0200 Subject: [PATCH] Use ~ for home path --- CHANGELOG.md | 4 +++- src/luals.ts | 17 ++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 504ac890..b36eb173 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 diff --git a/src/luals.ts b/src/luals.ts index df8c36bc..2e52c0f1 100644 --- a/src/luals.ts +++ b/src/luals.ts @@ -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 { 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");