Merge pull request #1538 from player-03/programPath
Allow running native apps from other directories.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package lime.system;
|
package lime.system;
|
||||||
|
|
||||||
#if (!lime_doc_gen || lime_cffi)
|
#if (!lime_doc_gen || lime_cffi)
|
||||||
|
import haxe.io.Path;
|
||||||
import lime._internal.macros.CFFIMacro;
|
import lime._internal.macros.CFFIMacro;
|
||||||
#if (sys && !macro)
|
#if (sys && !macro)
|
||||||
import sys.io.Process;
|
import sys.io.Process;
|
||||||
@@ -135,11 +136,16 @@ class CFFI
|
|||||||
|
|
||||||
__moduleNames.set(library, library);
|
__moduleNames.set(library, library);
|
||||||
|
|
||||||
result = __tryLoad("./" + library, library, method, args);
|
var programPath:String = ".";
|
||||||
|
#if sys
|
||||||
|
programPath = Path.directory(Sys.programPath());
|
||||||
|
#end
|
||||||
|
|
||||||
|
result = __tryLoad(programPath + "/" + library, library, method, args);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
result = __tryLoad(".\\" + library, library, method, args);
|
result = __tryLoad(programPath + "\\" + library, library, method, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package;
|
package;
|
||||||
|
|
||||||
import haxe.io.Bytes;
|
import haxe.io.Bytes;
|
||||||
|
import haxe.io.Path;
|
||||||
import lime.utils.AssetBundle;
|
import lime.utils.AssetBundle;
|
||||||
import lime.utils.AssetLibrary;
|
import lime.utils.AssetLibrary;
|
||||||
import lime.utils.AssetManifest;
|
import lime.utils.AssetManifest;
|
||||||
@@ -60,6 +61,8 @@ import sys.FileSystem;
|
|||||||
rootPath = "";
|
rootPath = "";
|
||||||
#elseif console
|
#elseif console
|
||||||
rootPath = lime.system.System.applicationDirectory;
|
rootPath = lime.system.System.applicationDirectory;
|
||||||
|
#elseif sys
|
||||||
|
rootPath = Path.directory(Sys.programPath()) + "/";
|
||||||
#else
|
#else
|
||||||
rootPath = "./";
|
rootPath = "./";
|
||||||
#end
|
#end
|
||||||
|
|||||||
Reference in New Issue
Block a user