-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
174 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package hxd.fs; | ||
|
||
class SourceLoader { | ||
|
||
static var RELOAD_LFS : Array<hxd.fs.FileSystem> = []; | ||
#if sys | ||
public static function addLivePath( path : String ) { | ||
RELOAD_LFS.push(new hxd.fs.LocalFileSystem(path,"")); | ||
} | ||
public static function addLivePathHaxelib( libs : Array<String> ) { | ||
var p = new sys.io.Process("haxelib",["path"].concat(libs)); | ||
var out = p.stdout.readAll().toString().split("\r\n").join("\n").split("\n"); | ||
p.exitCode(); | ||
for( line in out ) { | ||
if( line.charCodeAt(0) == "-".code ) continue; | ||
addLivePath(line); | ||
} | ||
} | ||
public static function initLivePaths() { | ||
addLivePath("."); | ||
addLivePathHaxelib(["heaps" #if hide,"hide"#end]); | ||
} | ||
#end | ||
|
||
public static function isActive() { | ||
return RELOAD_LFS.length > 0; | ||
} | ||
|
||
public static function resolve( path : String ) { | ||
for( fs in RELOAD_LFS ) | ||
try return fs.get(path) catch( e : hxd.res.NotFound ) {}; | ||
return null; | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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