mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Deleting a file without ext print a normal error msg.
This commit is contained in:
parent
b9c292f7cf
commit
afc1347d3a
@ -258,5 +258,6 @@ export const CONSTANTS: IMap<any> = {
|
|||||||
* Fix some ram not displayed as 0.00GB
|
* Fix some ram not displayed as 0.00GB
|
||||||
* Fix error message throw undefined variable error
|
* Fix error message throw undefined variable error
|
||||||
* City hall now has some generic text if you can't create a corp yet.
|
* City hall now has some generic text if you can't create a corp yet.
|
||||||
|
* Deleting a file without extension now returns an appropriate error message.
|
||||||
`,
|
`,
|
||||||
}
|
}
|
@ -181,6 +181,7 @@ export class BaseServer {
|
|||||||
* @returns {IReturnStatus} Return status object indicating whether or not file was deleted
|
* @returns {IReturnStatus} Return status object indicating whether or not file was deleted
|
||||||
*/
|
*/
|
||||||
removeFile(fn: string): IReturnStatus {
|
removeFile(fn: string): IReturnStatus {
|
||||||
|
console.log(`removing ${fn}`);
|
||||||
if (fn.endsWith(".exe") || fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null) {
|
if (fn.endsWith(".exe") || fn.match(/^.+\.exe-\d+(?:\.\d*)?%-INC$/) != null) {
|
||||||
for (let i = 0; i < this.programs.length; ++i) {
|
for (let i = 0; i < this.programs.length; ++i) {
|
||||||
if (this.programs[i] === fn) {
|
if (this.programs[i] === fn) {
|
||||||
|
@ -1313,9 +1313,17 @@ let Terminal = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check programs
|
// Check programs
|
||||||
let delTarget = Terminal.getFilepath(commandArray[1]);
|
let delTarget, status;
|
||||||
|
try {
|
||||||
|
delTarget = Terminal.getFilepath(commandArray[1]);
|
||||||
|
status = s.removeFile(delTarget);
|
||||||
|
} catch(err) {
|
||||||
|
status = {
|
||||||
|
res: false,
|
||||||
|
msg: 'No such file exists'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const status = s.removeFile(delTarget);
|
|
||||||
if (!status.res) {
|
if (!status.res) {
|
||||||
postError(status.msg);
|
postError(status.msg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user