From 08e4de1524e9c4b78e9e95bd5033ebeb4169d7d1 Mon Sep 17 00:00:00 2001 From: Geequlim Date: Fri, 24 Jul 2020 14:19:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A7=BB=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tiny/io.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tiny/io.ts b/src/tiny/io.ts index aafa10c..636e80e 100644 --- a/src/tiny/io.ts +++ b/src/tiny/io.ts @@ -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) { switch (get_runtime()) { case JavaScriptRuntime.NodeJS: @@ -166,4 +175,8 @@ export class NodeJSDirAccess extends DirAccess { static make_dir(p_dir: string, recursive: boolean = false) { fs.mkdirSync(p_dir, {recursive: true}); } + + static remove_file_or_error(path: string) { + fs.unlinkSync(path); + } } \ No newline at end of file