Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de9b94b

Browse files
committed
Merge pull request HaxeFoundation#226 from dpeek/fix/find-haxelib
Give priority to personal haxelib paths
2 parents 22c18bb + 62cf4a9 commit de9b94b

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

src/hx/Lib.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,23 +242,31 @@ String FindHaxelib(String inLib)
242242
printf( haxepath.length ? "Found local .haxelib\n" : "No local .haxelib\n");
243243
#endif
244244

245+
if (haxepath.length==0)
246+
{
247+
haxepath = GetEnv("HAXELIB_PATH");
248+
if (loadDebug)
249+
printf("HAXELIB_PATH env:%s\n", haxepath.__s);
250+
}
251+
252+
if (haxepath.length==0)
253+
{
254+
#ifdef _WIN32
255+
String home = GetEnv("HOMEDRIVE") + GetEnv("HOMEPATH") + HX_CSTRING("/.haxelib");
256+
#else
257+
String home = GetEnv("HOME") + HX_CSTRING("/.haxelib");
258+
#endif
259+
haxepath = GetFileContents(home);
260+
if (loadDebug)
261+
printf("HAXEPATH home:%s\n", haxepath.__s);
262+
}
263+
245264
if (haxepath.length==0)
246265
{
247266
haxepath = GetEnv("HAXEPATH");
248267
if (loadDebug)
249268
printf("HAXEPATH env:%s\n", haxepath.__s);
250-
if (haxepath.length==0)
251-
{
252-
#ifdef _WIN32
253-
String home = GetEnv("HOMEDRIVE") + GetEnv("HOMEPATH") + HX_CSTRING("/.haxelib");
254-
#else
255-
String home = GetEnv("HOME") + HX_CSTRING("/.haxelib");
256-
#endif
257-
haxepath = GetFileContents(home);
258-
if (loadDebug)
259-
printf("HAXEPATH home:%s\n", haxepath.__s);
260-
}
261-
else
269+
if (haxepath.length>0)
262270
{
263271
haxepath += HX_CSTRING("/lib");
264272
}

0 commit comments

Comments
 (0)