36 lines
729 B
JavaScript
36 lines
729 B
JavaScript
var io = os.use('io')
|
|
|
|
var tmpslurp = io.slurp;
|
|
io.slurp = function slurp(path)
|
|
{
|
|
var findpath = Resources.replpath(path);
|
|
var ret = tmpslurp(findpath, true); //|| core_db.slurp(findpath, true);
|
|
return ret;
|
|
}
|
|
|
|
io.slurpbytes = function(path)
|
|
{
|
|
path = Resources.replpath(path);
|
|
var ret = tmpslurp(path);// || core_db.slurp(path);
|
|
if (!ret) throw new Error(`Could not find file ${path} anywhere`);
|
|
return ret;
|
|
}
|
|
|
|
var ignore = io.slurp('.prosperonignore').split('\n');
|
|
var allpaths;
|
|
var tmpglob = io.glob;
|
|
io.glob = function glob(pat) {
|
|
if (!allpaths)
|
|
allpaths = io.globfs(ignore);
|
|
|
|
return allpaths.filter(str => game.glob(pat,str)).sort();
|
|
}
|
|
|
|
io.invalidate = function()
|
|
{
|
|
allpaths = undefined;
|
|
}
|
|
|
|
|
|
return io
|