Skip to content

Commit 7f40583

Browse files
committed
Update OsSettingsResolver.cs
1 parent 8701c2b commit 7f40583

1 file changed

Lines changed: 33 additions & 30 deletions

File tree

src/DiffEngine/OsSettingsResolver.cs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,43 +52,46 @@ static bool TryResolveForOs(
5252
[NotNullWhen(true)] out LaunchArguments? launchArguments,
5353
OSPlatform platform)
5454
{
55-
if (os != null &&
56-
RuntimeInformation.IsOSPlatform(platform))
55+
launchArguments = null;
56+
path = null;
57+
58+
if (os == null || !RuntimeInformation.IsOSPlatform(platform))
59+
{
60+
return false;
61+
}
62+
63+
if (os.EnvironmentVariable is not null)
5764
{
58-
if (os.EnvironmentVariable is not null)
65+
var basePath = Environment.GetEnvironmentVariable(os.EnvironmentVariable);
66+
if (basePath is not null)
5967
{
60-
var basePath = Environment.GetEnvironmentVariable(os.EnvironmentVariable);
61-
if (basePath is not null)
68+
if (basePath.EndsWith(os.ExeName) && File.Exists(basePath))
6269
{
63-
if (basePath.EndsWith(os.ExeName) && File.Exists(basePath))
64-
{
65-
}
66-
else if (Directory.Exists(basePath))
67-
{
68-
basePath = Path.Combine(basePath, os.ExeName);
69-
}
70-
else
71-
{
72-
launchArguments = null;
73-
path = null;
74-
return false;
75-
}
76-
if (WildcardFileFinder.TryFind(basePath, out path))
77-
{
78-
launchArguments = os.LaunchArguments;
79-
return true;
80-
}
8170
}
82-
}
83-
if (TryFindExe(os.ExeName, os.SearchDirectories, out path))
84-
{
85-
launchArguments = os.LaunchArguments;
86-
return true;
71+
else if (Directory.Exists(basePath))
72+
{
73+
basePath = Path.Combine(basePath, os.ExeName);
74+
}
75+
else
76+
{
77+
launchArguments = null;
78+
path = null;
79+
return false;
80+
}
81+
if (WildcardFileFinder.TryFind(basePath, out path))
82+
{
83+
launchArguments = os.LaunchArguments;
84+
return true;
85+
}
8786
}
8887
}
8988

90-
launchArguments = null;
91-
path = null;
89+
if (TryFindExe(os.ExeName, os.SearchDirectories, out path))
90+
{
91+
launchArguments = os.LaunchArguments;
92+
return true;
93+
}
94+
9295
return false;
9396
}
9497

0 commit comments

Comments
 (0)