Patch to get around Bitburner's filehandling

This commit is contained in:
Zoë Hoekstra 2022-09-19 20:02:05 +02:00
parent b89909937b
commit 09bfd00fc4
No known key found for this signature in database
GPG key ID: F9B7B7D8130F3323

View file

@ -10,7 +10,7 @@ export function fileChangeEventToMsg({ path }) {
"method": "pushFile",
"params": {
"server": "home",
"filename": "/" + path,
"filename": addLeadingSlash(path),
"content": readFileSync(join(config.get("scriptsFolder"), path)).toString()
},
"id": messageCounter++
@ -46,3 +46,11 @@ export function requestFilenames() {
"id": messageCounter++
}
}
function addLeadingSlash(path){
const slashes = path.match('/');
if (slashes)
return `/${path}`
else
return path
}