From d6a1476cc4e76e1978ddcb88d6ec2b62a8b4a056 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 7 Apr 2022 14:32:23 +0200 Subject: [PATCH] check if file exists --- apps/remix-ide/src/app/tabs/compile-and-run.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/remix-ide/src/app/tabs/compile-and-run.ts b/apps/remix-ide/src/app/tabs/compile-and-run.ts index add317e318..7ea9308b2c 100644 --- a/apps/remix-ide/src/app/tabs/compile-and-run.ts +++ b/apps/remix-ide/src/app/tabs/compile-and-run.ts @@ -50,6 +50,11 @@ export class CompileAndRun extends Plugin { async runScript (fileName, clearAllInstances) { await this.call('terminal', 'log', `running ${fileName} ...`) try { + const exists = await this.call('fileManager', 'exists', fileName) + if (!exists) { + await this.call('terminal', 'log', `${fileName} does not exist.`) + return + } const content = await this.call('fileManager', 'readFile', fileName) if (clearAllInstances) { await this.call('udapp', 'clearAllInstances')