diff --git a/VSCodeHelper/VSCodeInstances.cs b/VSCodeHelper/VSCodeInstances.cs index 64e869d..535cc64 100644 --- a/VSCodeHelper/VSCodeInstances.cs +++ b/VSCodeHelper/VSCodeInstances.cs @@ -64,8 +64,8 @@ public static void LoadVSCodeInstances() { if (_systemPath == Environment.GetEnvironmentVariable("PATH")) return; - - + + Instances = new List(); _systemPath = Environment.GetEnvironmentVariable("PATH") ?? ""; @@ -77,17 +77,24 @@ public static void LoadVSCodeInstances() { if (!Directory.Exists(path)) continue; - - var files = Directory.EnumerateFiles(path).Where(x => + + var newPath = path; + if (!Path.GetFileName(path).Equals("bin", StringComparison.OrdinalIgnoreCase)) + newPath = Path.Combine(path, "bin"); + + if (!Directory.Exists(newPath)) + continue; + + var files = Directory.EnumerateFiles(newPath).Where(x => (x.Contains("code", StringComparison.OrdinalIgnoreCase) || x.Contains("codium", StringComparison.OrdinalIgnoreCase)) && !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray(); - var iconPath = Path.GetDirectoryName(path); + var iconPath = Path.GetDirectoryName(newPath); if (files.Length <= 0) continue; - + var file = files[0]; var version = string.Empty; @@ -119,8 +126,8 @@ public static void LoadVSCodeInstances() if (version == string.Empty) continue; - - + + var portableData = Path.Join(iconPath, "data"); instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version); var iconVSCode = Path.Join(iconPath, $"{version}.exe"); @@ -140,4 +147,4 @@ public static void LoadVSCodeInstances() } } } -} +} \ No newline at end of file diff --git a/plugin.json b/plugin.json index 698bc51..ae22e22 100644 --- a/plugin.json +++ b/plugin.json @@ -3,8 +3,8 @@ "Decription": "Opens workspaces, remote machines (SSH or Codespaces) and containers, previously opened in VS Code.", "ActionKeyword": "{", "Name": "VS Code Workspaces", - "Author": "ricardosantos9521", - "Version": "1.3.1", + "Author": "ricardosantos9521, MaskedRPGFan", + "Version": "1.3.2", "Language": "csharp", "Website": "https://github.com/taooceros/Flow.Plugin.VSCodeWorkspace", "ExecuteFileName": "Flow.Plugin.VSCodeWorkspaces.dll",