Skip to content

Commit

Permalink
Check for the trailing backslash in the GTK_BASEPATH and if it's not
Browse files Browse the repository at this point in the history
pressent add it.
  • Loading branch information
MikeWey committed Jan 28, 2013
1 parent c175d4b commit 7e54919
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 66 deletions.
37 changes: 4 additions & 33 deletions src/gtkc/paths.d
Original file line number Diff line number Diff line change
Expand Up @@ -166,45 +166,16 @@ version(Windows)

libPath = GetEnvironmentVariable("GTK_BASEPATH");

if ( libPath.length > 0 )
if ( libPath.length > 5 )
{
if ( libPath.length > 5 && libPath[$-5..$] == "\\bin\\" )
if ( libPath[$-5..$] == "\\bin\\" )
return libPath;
else if ( libPath[$-4..$] == "\\bin" )
return libPath ~ "\\";
else
return libPath ~ "\\bin\\";
}

/* Throws an Access Violation with DMD 2.*
// version(Phobos)
version(Tango){} else
{
// When using phobos Also try the Register
Key k = Registry.localMachine();
debug(register) foreach ( Key key ; k.keys() )
{
writefln("key = ", key.name());
}
try
{
k = k.getKey("SOFTWARE");
//writefln("key.value = %s", k.name());
k = k.getKey("GTK");
//writefln("key.value = %s", k.name());
k = k.getKey("2.0");
//writefln("key.value = %s", k.name());
Value v = k.getValue("DllPath");
libPath = v.value_SZ() ~ "\\";
}
catch ( Exception e )
{
libPath = "";
}
}
*/

// Returns the found location or an empty string
// to load the libraries from the path.
// see http://msdn2.microsoft.com/en-us/library/ms682586(VS.85).aspx
Expand Down
37 changes: 4 additions & 33 deletions wrap/paths.d
Original file line number Diff line number Diff line change
Expand Up @@ -166,45 +166,16 @@ version(Windows)

libPath = GetEnvironmentVariable("GTK_BASEPATH");

if ( libPath.length > 0 )
if ( libPath.length > 5 )
{
if ( libPath.length > 5 && libPath[$-5..$] == "\\bin\\" )
if ( libPath[$-5..$] == "\\bin\\" )
return libPath;
else if ( libPath[$-4..$] == "\\bin" )
return libPath ~ "\\";
else
return libPath ~ "\\bin\\";
}

/* Throws an Access Violation with DMD 2.*
// version(Phobos)
version(Tango){} else
{
// When using phobos Also try the Register
Key k = Registry.localMachine();
debug(register) foreach ( Key key ; k.keys() )
{
writefln("key = ", key.name());
}
try
{
k = k.getKey("SOFTWARE");
//writefln("key.value = %s", k.name());
k = k.getKey("GTK");
//writefln("key.value = %s", k.name());
k = k.getKey("2.0");
//writefln("key.value = %s", k.name());
Value v = k.getValue("DllPath");
libPath = v.value_SZ() ~ "\\";
}
catch ( Exception e )
{
libPath = "";
}
}
*/

// Returns the found location or an empty string
// to load the libraries from the path.
// see http://msdn2.microsoft.com/en-us/library/ms682586(VS.85).aspx
Expand Down

0 comments on commit 7e54919

Please sign in to comment.