check if file exists

pull/5370/head
yann300 3 years ago
parent 0feec2e3d8
commit d6a1476cc4
  1. 5
      apps/remix-ide/src/app/tabs/compile-and-run.ts

@ -50,6 +50,11 @@ export class CompileAndRun extends Plugin {
async runScript (fileName, clearAllInstances) { async runScript (fileName, clearAllInstances) {
await this.call('terminal', 'log', `running ${fileName} ...`) await this.call('terminal', 'log', `running ${fileName} ...`)
try { 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) const content = await this.call('fileManager', 'readFile', fileName)
if (clearAllInstances) { if (clearAllInstances) {
await this.call('udapp', 'clearAllInstances') await this.call('udapp', 'clearAllInstances')

Loading…
Cancel
Save