Skip to content

Commit fe58bac

Browse files
committed
add .exe when searching for executable files (prevent interferences from scripts)
1 parent 6f9fd08 commit fe58bac

5 files changed

Lines changed: 12 additions & 21 deletions

File tree

src/UniGetUI.PackageEngine.Managers.Cargo/Cargo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected override IReadOnlyList<Package> GetInstalledPackages_UnSafe()
138138

139139
public override IReadOnlyList<string> FindCandidateExecutableFiles()
140140
{
141-
return CoreTools.WhichMultiple("cargo");
141+
return CoreTools.WhichMultiple("cargo.exe");
142142
}
143143

144144
protected override ManagerStatus LoadManager()

src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected override IReadOnlyList<Package> _getInstalledPackages_UnSafe()
126126

127127
public override IReadOnlyList<string> FindCandidateExecutableFiles()
128128
{
129-
return CoreTools.WhichMultiple("dotnet");
129+
return CoreTools.WhichMultiple("dotnet.exe");
130130
}
131131

132132
protected override ManagerStatus LoadManager()

src/UniGetUI.PackageEngine.Managers.PowerShell/PowerShell.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,9 @@ protected override IReadOnlyList<Package> _getInstalledPackages_UnSafe()
118118

119119
public override List<string> FindCandidateExecutableFiles()
120120
{
121-
string path = CoreData.PowerShell5;
122-
var paths = CoreTools.WhichMultiple("powershell");
123-
if (File.Exists(path) && !paths.Contains(path, StringComparer.OrdinalIgnoreCase))
124-
{
125-
paths.Add(path);
126-
}
127-
128-
return paths;
121+
var candidates = CoreTools.WhichMultiple("powershell.exe");
122+
if(candidates.Count is 0) candidates.Add(CoreData.PowerShell5);
123+
return candidates;
129124
}
130125

131126
protected override ManagerStatus LoadManager()

src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected override IReadOnlyList<Package> _getInstalledPackages_UnSafe()
118118

119119
public override IReadOnlyList<string> FindCandidateExecutableFiles()
120120
{
121-
return CoreTools.WhichMultiple("pwsh");
121+
return CoreTools.WhichMultiple("pwsh.exe");
122122
}
123123

124124
protected override ManagerStatus LoadManager()

src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,20 +289,16 @@ protected override IReadOnlyList<Package> GetInstalledPackages_UnSafe()
289289

290290
public override IReadOnlyList<string> FindCandidateExecutableFiles()
291291
{
292-
var FoundPaths = CoreTools.WhichMultiple("vcpkg");
293-
List<string> Paths = [];
292+
var candidates = CoreTools.WhichMultiple("vcpkg.exe");
294293

295-
if (FoundPaths.Any()) foreach (var Path in FoundPaths) Paths.Add(Path);
296-
297-
var (VcpkgRootFound, VcpkgRoot) = GetVcpkgRoot();
298-
if (VcpkgRootFound)
294+
var (rootFound, rootPath) = GetVcpkgRoot();
295+
if (rootFound)
299296
{
300-
string VcpkgLocation = Path.Join(VcpkgRoot, "vcpkg.exe");
301-
302-
if (File.Exists(VcpkgLocation)) Paths.Add(VcpkgLocation);
297+
string VcpkgLocation = Path.Join(rootPath, "vcpkg.exe");
298+
if (File.Exists(VcpkgLocation)) candidates.Add(VcpkgLocation);
303299
}
304300

305-
return Paths;
301+
return candidates;
306302
}
307303

308304
protected override ManagerStatus LoadManager()

0 commit comments

Comments
 (0)