From 6e6bfcc3739d3891121ee6af56fb50edc49c665a Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 1 Dec 2017 18:37:11 +0100 Subject: [PATCH] currentPath and add to API --- src/app.js | 3 +++ src/app/files/fileManager.js | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/app.js b/src/app.js index d8af642903..e02232ed37 100644 --- a/src/app.js +++ b/src/app.js @@ -569,6 +569,9 @@ function run () { fileProvider: (name) => { return self._api.filesProviders[name] }, + currentPath: function () { + return fileManager.currentPath() + }, getBalance: (address, callback) => { udapp.getBalance(address, (error, balance) => { if (error) { diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 4a641416f8..e405ad6006 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -79,6 +79,13 @@ class FileManager { this.refreshTabs() } + currentPath () { + var currentFile = this.opt.config.get('currentFile') + var reg = /(.*\/).*/ + var path = reg.exec(currentFile) + return path ? path[1] : null + } + fileRemovedEvent (path) { if (path === this.opt.config.get('currentFile')) { this.opt.config.set('currentFile', '')