添加移除文件接口
This commit is contained in:
@@ -81,6 +81,15 @@ export class DirAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static remove_file_or_error(path: string) {
|
||||||
|
switch (get_runtime()) {
|
||||||
|
case JavaScriptRuntime.NodeJS:
|
||||||
|
return NodeJSDirAccess.remove_file_or_error(path);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static make_dir(p_dir: string, recursive: boolean = false) {
|
static make_dir(p_dir: string, recursive: boolean = false) {
|
||||||
switch (get_runtime()) {
|
switch (get_runtime()) {
|
||||||
case JavaScriptRuntime.NodeJS:
|
case JavaScriptRuntime.NodeJS:
|
||||||
@@ -166,4 +175,8 @@ export class NodeJSDirAccess extends DirAccess {
|
|||||||
static make_dir(p_dir: string, recursive: boolean = false) {
|
static make_dir(p_dir: string, recursive: boolean = false) {
|
||||||
fs.mkdirSync(p_dir, {recursive: true});
|
fs.mkdirSync(p_dir, {recursive: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static remove_file_or_error(path: string) {
|
||||||
|
fs.unlinkSync(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user