Skip to content

Commit 17ab29b

Browse files
Eiderentebjan
authored andcommitted
[System] Fix binary path location when the dlls are run from an unexpected executable
1 parent 6c5b7c8 commit 17ab29b

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

sources/core/Stride.Core/PlatformFolders.cs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,10 @@ private static string GetApplicationTemporaryDirectory()
184184
[NotNull]
185185
private static string GetApplicationBinaryDirectory()
186186
{
187-
var executablePath = GetApplicationExecutableDirectory();
188187
#if STRIDE_PLATFORM_ANDROID
189-
return executablePath;
188+
return GetApplicationExecutableDirectory();
190189
#else
191-
return FindCoreAssemblyDirectory(executablePath);
190+
return Path.GetDirectoryName(typeof(PlatformFolders).Assembly.Location);
192191
#endif
193192
}
194193

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

215-
static string FindCoreAssemblyDirectory(string entryDirectory)
216-
{
217-
//simple case
218-
var corePath = Path.Combine(entryDirectory, "Stride.Core.dll");
219-
if (File.Exists(corePath))
220-
{
221-
return entryDirectory;
222-
}
223-
else //search one level down
224-
{
225-
foreach (var subfolder in Directory.GetDirectories(entryDirectory))
226-
{
227-
corePath = Path.Combine(subfolder, "Stride.Core.dll");
228-
if (File.Exists(corePath))
229-
{
230-
return subfolder;
231-
}
232-
}
233-
}
234-
235-
//if nothing found, return input
236-
return entryDirectory;
237-
}
238-
239214
[NotNull]
240215
private static string GetApplicationDataDirectory()
241216
{

0 commit comments

Comments
 (0)