Skip to content

Commit e4ef340

Browse files
authored
Merge pull request #15 from MaskedRPGFan/portable_instances_fix
2 parents 6515058 + 809ea5b commit e4ef340

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

VSCodeHelper/VSCodeInstances.cs

+16-9
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public static void LoadVSCodeInstances()
6464
{
6565
if (_systemPath == Environment.GetEnvironmentVariable("PATH"))
6666
return;
67-
68-
67+
68+
6969
Instances = new List<VSCodeInstance>();
7070

7171
_systemPath = Environment.GetEnvironmentVariable("PATH") ?? "";
@@ -77,17 +77,24 @@ public static void LoadVSCodeInstances()
7777
{
7878
if (!Directory.Exists(path))
7979
continue;
80-
81-
var files = Directory.EnumerateFiles(path).Where(x =>
80+
81+
var newPath = path;
82+
if (!Path.GetFileName(path).Equals("bin", StringComparison.OrdinalIgnoreCase))
83+
newPath = Path.Combine(path, "bin");
84+
85+
if (!Directory.Exists(newPath))
86+
continue;
87+
88+
var files = Directory.EnumerateFiles(newPath).Where(x =>
8289
(x.Contains("code", StringComparison.OrdinalIgnoreCase) ||
8390
x.Contains("codium", StringComparison.OrdinalIgnoreCase))
8491
&& !x.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)).ToArray();
8592

86-
var iconPath = Path.GetDirectoryName(path);
93+
var iconPath = Path.GetDirectoryName(newPath);
8794

8895
if (files.Length <= 0)
8996
continue;
90-
97+
9198
var file = files[0];
9299
var version = string.Empty;
93100

@@ -119,8 +126,8 @@ public static void LoadVSCodeInstances()
119126

120127
if (version == string.Empty)
121128
continue;
122-
123-
129+
130+
124131
var portableData = Path.Join(iconPath, "data");
125132
instance.AppData = Directory.Exists(portableData) ? Path.Join(portableData, "user-data") : Path.Combine(_userAppDataPath, version);
126133
var iconVSCode = Path.Join(iconPath, $"{version}.exe");
@@ -140,4 +147,4 @@ public static void LoadVSCodeInstances()
140147
}
141148
}
142149
}
143-
}
150+
}

plugin.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"Decription": "Opens workspaces, remote machines (SSH or Codespaces) and containers, previously opened in VS Code.",
44
"ActionKeyword": "{",
55
"Name": "VS Code Workspaces",
6-
"Author": "ricardosantos9521",
7-
"Version": "1.3.1",
6+
"Author": "ricardosantos9521, MaskedRPGFan",
7+
"Version": "1.3.2",
88
"Language": "csharp",
99
"Website": "https://github.com/taooceros/Flow.Plugin.VSCodeWorkspace",
1010
"ExecuteFileName": "Flow.Plugin.VSCodeWorkspaces.dll",

0 commit comments

Comments
 (0)