check dir exists

pull/1342/head
bunsenstraat 3 years ago committed by davidzagi93@gmail.com
parent 154a5bb2f0
commit cf184e000f
  1. 8
      apps/remix-ide/src/app/files/dgitProvider.js

@ -432,12 +432,13 @@ class DGitProvider extends Plugin {
const dir = path.dirname(file.path) const dir = path.dirname(file.path)
try { try {
this.createDirectories(`${workspace.absolutePath}/${dir}`) this.createDirectories(`${workspace.absolutePath}/${dir}`)
} catch (e) { } } catch (e) { throw new Error(e) }
try { try {
window.remixFileSystem.writeFileSync(`${workspace.absolutePath}/${file.path}`, Buffer.concat(content) || new Uint8Array()) window.remixFileSystem.writeFileSync(`${workspace.absolutePath}/${file.path}`, Buffer.concat(content) || new Uint8Array())
} catch (e) { } } catch (e) { throw new Error(e) }
} }
} catch (e) { } catch (e) {
throw new Error(e)
} }
return result return result
} }
@ -517,8 +518,11 @@ class DGitProvider extends Plugin {
if (i > 0) previouspath = '/' + directories.slice(0, i).join('/') if (i > 0) previouspath = '/' + directories.slice(0, i).join('/')
const finalPath = previouspath + '/' + directories[i] const finalPath = previouspath + '/' + directories[i]
try { try {
if (!window.remixFileSystem.existsSync(finalPath)) {
window.remixFileSystem.mkdirSync(finalPath) window.remixFileSystem.mkdirSync(finalPath)
}
} catch (e) { } catch (e) {
console.log(e)
} }
} }
} }

Loading…
Cancel
Save