mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-09-19 20:38:42 +02:00
Merge pull request #4220 from cptpiepmatz/fix-nano-not-opening-root-script-if-in-dir
UI: Fixed `nano` not correctly opening a script in root of a server if `cd`'d into a directory
This commit is contained in:
commit
d0fe28f8fb
@ -150,8 +150,12 @@ export function ls(args: (string | number | boolean)[], server: BaseServer): voi
|
|||||||
return Terminal.error(`File is not on this server, connect to ${hostname} and try again`);
|
return Terminal.error(`File is not on this server, connect to ${hostname} and try again`);
|
||||||
}
|
}
|
||||||
if (filename.startsWith("/")) filename = filename.slice(1);
|
if (filename.startsWith("/")) filename = filename.slice(1);
|
||||||
|
// Terminal.getFilepath needs leading slash to correctly work here
|
||||||
|
if (prefix === "") filename = `/${filename}`;
|
||||||
const filepath = Terminal.getFilepath(`${prefix}${filename}`);
|
const filepath = Terminal.getFilepath(`${prefix}${filename}`);
|
||||||
const code = toString(Terminal.getScript(filepath)?.code);
|
// Terminal.getScript also calls Terminal.getFilepath and therefore also
|
||||||
|
// needs the given parameter
|
||||||
|
const code = toString(Terminal.getScript(`${prefix}${filename}`)?.code);
|
||||||
Router.toScriptEditor({ [filepath]: code });
|
Router.toScriptEditor({ [filepath]: code });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user