check if file exist

pull/2470/head
yann300 3 years ago
parent 6601939469
commit 7123823081
  1. 2
      apps/remix-ide/src/app/editor/editor.js

@ -185,10 +185,12 @@ 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'
if (await this.call('fileManager', 'exists', path)) {
content = await this.call('fileManager', 'readFile', path) content = await this.call('fileManager', 'readFile', path)
this.emit('addModel', content, 'typescript', path, false) this.emit('addModel', content, 'typescript', path, false)
} }
} }
}
}) })
try { try {
this.currentThemeType = (await this.call('theme', 'currentTheme')).quality this.currentThemeType = (await this.call('theme', 'currentTheme')).quality

Loading…
Cancel
Save