Skip to content

Commit

Permalink
[System] Fix binary path location when the dlls are run from an unexp…
Browse files Browse the repository at this point in the history
…ected executable
  • Loading branch information
Eideren authored and tebjan committed Sep 17, 2023
1 parent 6c5b7c8 commit 17ab29b
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions sources/core/Stride.Core/PlatformFolders.cs
Original file line number Diff line number Diff line change
@@ -184,11 +184,10 @@ private static string GetApplicationTemporaryDirectory()
[NotNull]
private static string GetApplicationBinaryDirectory()
{
var executablePath = GetApplicationExecutableDirectory();
#if STRIDE_PLATFORM_ANDROID
return executablePath;
return GetApplicationExecutableDirectory();
#else
return FindCoreAssemblyDirectory(executablePath);
return Path.GetDirectoryName(typeof(PlatformFolders).Assembly.Location);
#endif
}

@@ -212,30 +211,6 @@ private static string GetApplicationExecutableDirectory()
#endif
}

static string FindCoreAssemblyDirectory(string entryDirectory)
{
//simple case
var corePath = Path.Combine(entryDirectory, "Stride.Core.dll");
if (File.Exists(corePath))
{
return entryDirectory;
}
else //search one level down
{
foreach (var subfolder in Directory.GetDirectories(entryDirectory))
{
corePath = Path.Combine(subfolder, "Stride.Core.dll");
if (File.Exists(corePath))
{
return subfolder;
}
}
}

//if nothing found, return input
return entryDirectory;
}

[NotNull]
private static string GetApplicationDataDirectory()
{

0 comments on commit 17ab29b

Please sign in to comment.