From 0341166ea4b7352012a0ff24823b8747ff66ff31 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 16 Apr 2020 13:40:32 +0000 Subject: [PATCH] Changed logic for file/dir exists to use file provider --- src/app/files/fileManager.js | 6 +++++- src/app/files/fileProvider.js | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index d4317738a8..443cc75735 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -120,7 +120,11 @@ class FileManager extends Plugin { */ exists (path) { const provider = this.fileProviderOf(path) - return provider ? true : false // eslint-disable-line + + return provider.exists(path, (err, result) => { + if (err) return false + return result + }) } /** diff --git a/src/app/files/fileProvider.js b/src/app/files/fileProvider.js index f5e03197e2..0230d22fe8 100644 --- a/src/app/files/fileProvider.js +++ b/src/app/files/fileProvider.js @@ -66,12 +66,12 @@ class FileProvider { exists (path, cb) { // todo check the type (directory/file) as well #2386 // currently it is not possible to have a file and folder with same path - cb(null, this._exists(path)) + return cb(null, this._exists(path)) } _exists (path) { var unprefixedpath = this.removePrefix(path) - return window.remixFileSystem.existsSync(unprefixedpath) + return path === this.type ? true : window.remixFileSystem.existsSync(unprefixedpath) } init (cb) { @@ -79,6 +79,7 @@ class FileProvider { } get (path, cb) { + console.log('window.remixFileSystem: ', window.remixFileSystem) cb = cb || function () {} path = this.getPathFromUrl(path) || path // ensure we actually use the normalized path from here var unprefixedpath = this.removePrefix(path)