add private _exist function to browser-files.js

pull/1/head
yann300 7 years ago
parent ccdc138b9b
commit 26d5e1cb15
  1. 12
      src/app/files/browser-files.js

@ -9,11 +9,15 @@ function Files (storage) {
this.type = 'browser' this.type = 'browser'
this.exists = function (path, cb) { this.exists = function (path, cb) {
cb(null, this._exists(path))
}
this._exists = function (path) {
var unprefixedpath = this.removePrefix(path) var unprefixedpath = this.removePrefix(path)
// NOTE: ignore the config file // NOTE: ignore the config file
if (path === '.remix.config') return cb(null, false) if (path === '.remix.config') return false
return cb(null, this.isReadOnly(unprefixedpath) || storage.exists(unprefixedpath)) return this.isReadOnly(unprefixedpath) || storage.exists(unprefixedpath)
} }
this.init = function (cb) { this.init = function (cb) {
@ -75,7 +79,7 @@ function Files (storage) {
this.remove = function (path) { this.remove = function (path) {
var unprefixedpath = this.removePrefix(path) var unprefixedpath = this.removePrefix(path)
if (!this.exists(unprefixedpath)) { if (!this._exists(unprefixedpath)) {
return false return false
} }
@ -133,7 +137,7 @@ function Files (storage) {
} }
// rename .browser-solidity.json to .remix.config // rename .browser-solidity.json to .remix.config
if (this.exists('.browser-solidity.json')) { if (this._exists('.browser-solidity.json')) {
this.rename('.browser-solidity.json', '.remix.config') this.rename('.browser-solidity.json', '.remix.config')
} }
} }

Loading…
Cancel
Save