Patch to get around Bitburner's filehandling
This commit is contained in:
parent
b89909937b
commit
09bfd00fc4
1 changed files with 9 additions and 1 deletions
|
@ -10,7 +10,7 @@ export function fileChangeEventToMsg({ path }) {
|
||||||
"method": "pushFile",
|
"method": "pushFile",
|
||||||
"params": {
|
"params": {
|
||||||
"server": "home",
|
"server": "home",
|
||||||
"filename": "/" + path,
|
"filename": addLeadingSlash(path),
|
||||||
"content": readFileSync(join(config.get("scriptsFolder"), path)).toString()
|
"content": readFileSync(join(config.get("scriptsFolder"), path)).toString()
|
||||||
},
|
},
|
||||||
"id": messageCounter++
|
"id": messageCounter++
|
||||||
|
@ -45,4 +45,12 @@ export function requestFilenames() {
|
||||||
},
|
},
|
||||||
"id": messageCounter++
|
"id": messageCounter++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addLeadingSlash(path){
|
||||||
|
const slashes = path.match('/');
|
||||||
|
if (slashes)
|
||||||
|
return `/${path}`
|
||||||
|
else
|
||||||
|
return path
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue