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",
|
||||
"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
|
||||
}
|
Loading…
Add table
Reference in a new issue