[System] Fix binary path location when the dlls are run from an unexpected executable

This commit is contained in:
Eideren 2023-09-15 17:08:07 +02:00 коммит произвёл Tebjan Halm
Родитель 6c5b7c8d65
Коммит 17ab29b700
1 изменённых файлов: 2 добавлений и 27 удалений

Просмотреть файл

@ -184,11 +184,10 @@ namespace Stride.Core
[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 @@ namespace Stride.Core
#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()
{