Skip to content

Commit 3d48c85

Browse files
committed
Fix can't find Unturned_Data
1 parent d21e85c commit 3d48c85

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/UnturnedRedistUpdateTool/Program.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,25 +156,13 @@ void AssertPlatformSupported()
156156

157157
string GetUnturnedDataDirectoryName()
158158
{
159-
if (linux)
160-
{
161-
const string linuxUnturnedDataDirectoryName = "Unturned_Headless_Data";
162-
var headless = Path.Combine(unturnedPath, linuxUnturnedDataDirectoryName);
163-
if (Directory.Exists(headless))
164-
{
165-
return headless;
166-
}
167-
}
168-
else if (windows)
169-
{
170-
const string windowsUnturnedDataDirectoryName = "Unturned_Data";
171-
var usual = Path.Combine(unturnedPath, windowsUnturnedDataDirectoryName);
172-
if (Directory.Exists(usual))
173-
{
174-
return usual;
175-
}
176-
}
177-
throw new DirectoryNotFoundException($"Unturned Data directory cannot be found in {unturnedPath}");
159+
string[] possiblePath =
160+
[
161+
Path.Combine(unturnedPath, "Unturned_Headless_Data"),
162+
Path.Combine(unturnedPath, "Unturned_Data")
163+
];
164+
return possiblePath.FirstOrDefault(Directory.Exists)
165+
?? throw new DirectoryNotFoundException($"Unturned Data directory cannot be found in {unturnedPath}");
178166
}
179167
}
180168

0 commit comments

Comments
 (0)