Hello, I started using Pri.LongPath on Mono (Unity3D) about 3 years ago and ran into a problem: attribute DllImport("kernel32.dll") doesn't work on macOS (Linux). Then I had to write a check and an additional layer that would determine the OS type and choose Pri.LongPath for Windows and the default System.IO for everyone else (MacOS or Linux, i have tested only MacOS).
Yesterday I decided to update the Pri.LongPath version and founded that the mono check has added:
public static bool IsRunningOnMono() { return Type.GetType("Mono.Runtime") != null; }
Accordingly, Pri.LongPath has began to check the application framework and if mono, then use default System.IO. This means that on mono the library actually do nothing! We have all the same problems with long paths if app is running on mono and on windows, but the library do nothing!
Why does Pri.LongPath check the framework type instead of OS type? For example instead of "IsRunningOnMono()" Pri.LongPath could use "IsNotWindows()":
From https://www.mono-project.com/docs/faq/technical/
public static bool IsNotWindows() { var p = (int)Environment.OSVersion.Platform; return (p == 4) || (p == 6) || (p == 128); }
On windows, all calls to DllImport("kernel32.dll") work fine on both dotnet and mono, so we need an ability of using Pri.LongPath power on Mono+Windows too.
Hello, I started using Pri.LongPath on Mono (Unity3D) about 3 years ago and ran into a problem: attribute DllImport("kernel32.dll") doesn't work on macOS (Linux). Then I had to write a check and an additional layer that would determine the OS type and choose Pri.LongPath for Windows and the default System.IO for everyone else (MacOS or Linux, i have tested only MacOS).
Yesterday I decided to update the Pri.LongPath version and founded that the mono check has added:
public static bool IsRunningOnMono() { return Type.GetType("Mono.Runtime") != null; }Accordingly, Pri.LongPath has began to check the application framework and if mono, then use default System.IO. This means that on mono the library actually do nothing! We have all the same problems with long paths if app is running on mono and on windows, but the library do nothing!
Why does Pri.LongPath check the framework type instead of OS type? For example instead of "IsRunningOnMono()" Pri.LongPath could use "IsNotWindows()":
From https://www.mono-project.com/docs/faq/technical/
public static bool IsNotWindows() { var p = (int)Environment.OSVersion.Platform; return (p == 4) || (p == 6) || (p == 128); }On windows, all calls to DllImport("kernel32.dll") work fine on both dotnet and mono, so we need an ability of using Pri.LongPath power on Mono+Windows too.