From the Using haxelib wiki page:
When run.n is called from haxelib, the current working directory will be set to the library directory (eg. /usr/lib/haxe/lib/somelib/1,0/). The directory of haxelib being called will instead be passed as an extra argument, put at the end of the argument array.
Example usage:
var haxelibDir = Sys.getCwd();
var userDir = Sys.args().pop();
Sys.setCwd( userDir );
// Now copy a sample file from the haxelib dir to the user's current dir:
var content = File.getContent( '$haxelibDir/tpl/myfile.txt' );
File.saveContent( '$userDir/myfile.txt', content );