Created
May 31, 2012 21:07
-
-
Save nulltoken/2846311 to your computer and use it in GitHub Desktop.
[LibGit2Sharp] Issue while loading the native dll on Mono/Windows x86
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
string originalAssemblypath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath; | |
string parentPath = Path.GetDirectoryName(originalAssemblypath); | |
string currentArchSubPath = "NativeBinaries/" + ProcessorArchitecture; | |
string path = Path.Combine(parentPath, currentArchSubPath); | |
Console.WriteLine("{0} = {1}", "originalAssemblypath", originalAssemblypath); | |
Console.WriteLine("{0} = {1}", "parentPath", parentPath); | |
Console.WriteLine("{0} = {1}", "currentArchSubPath", currentArchSubPath); | |
Console.WriteLine("{0} = {1}", "path", path); | |
Console.WriteLine(); | |
Console.WriteLine("{0} = {1}", "PATH.Machine", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine)); | |
Console.WriteLine("{0} = {1}", "PATH.User", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User)); | |
Console.WriteLine("{0} = {1}", "PATH.Process", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process)); | |
try | |
{ | |
Console.WriteLine(Repository.Version); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine(); | |
Console.WriteLine("{0} = {1}", "PATH.Machine", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine)); | |
Console.WriteLine("{0} = {1}", "PATH.User", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User)); | |
Console.WriteLine("{0} = {1}", "PATH.Process", Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process)); | |
throw; | |
} | |
Console.ReadLine(); | |
} | |
public static string ProcessorArchitecture | |
{ | |
get | |
{ | |
if (IntPtr.Size == 8) | |
{ | |
return "amd64"; | |
} | |
return "x86"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment