check if file exist

pull/5370/head
yann300 3 years ago
parent b5c06844cc
commit 3d07b4b621
  1. 6
      apps/remix-ide/src/app/editor/editor.js

@ -165,8 +165,10 @@ class Editor extends Plugin {
if (path.startsWith('./') || path.startsWith('../')) path = resolve(fromPath, path) if (path.startsWith('./') || path.startsWith('../')) path = resolve(fromPath, path)
if (path.startsWith('/')) path = path.substring(1) if (path.startsWith('/')) path = path.substring(1)
if (!path.endsWith('.ts')) path = path + '.ts' if (!path.endsWith('.ts')) path = path + '.ts'
content = await this.call('fileManager', 'readFile', path) if (await this.call('fileManager', 'exists', path)) {
this.emit('addModel', content, 'typescript', path, false) content = await this.call('fileManager', 'readFile', path)
this.emit('addModel', content, 'typescript', path, false)
}
} }
} }
}) })

Loading…
Cancel
Save