From e05f77ec27b3315f29267ea446d31f85fb02a99a Mon Sep 17 00:00:00 2001 From: "Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics" Date: Fri, 20 Aug 2021 13:50:33 +0200 Subject: [PATCH] [Common] Added caching custom virutal paths This change is related to: https://review.tizen.org/gerrit/#/c/platform/core/api/webapi-plugins/+/260943/ As in some scenarios (when new storage is mounted) webapi clears cache, there is a need to restore custom virtual paths which are set with setVirtualPath() method. [Verification] Code compiles without errors. Change-Id: I9dde4025526936e8988ff610f70894d4dbb00e60 --- src/filesystem/js/common.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/filesystem/js/common.js b/src/filesystem/js/common.js index d3c17cd3..ac876934 100644 --- a/src/filesystem/js/common.js +++ b/src/filesystem/js/common.js @@ -48,6 +48,7 @@ var commonFS_ = (function() { var cacheReady = false; var listenerRegistered = false; var cacheVirtualToReal = {}; + var userVirtual = {}; var cacheStorages = []; var uriPrefix = 'file://'; // special condition for previous versions paths @@ -104,6 +105,10 @@ var commonFS_ = (function() { // (global paths usage issue workaround) initHomeDir(); + for (var name in userVirtual) { + cacheVirtualToReal[name] = userVirtual[name]; + } + var result = native_.callSync('FileSystemManagerFetchStorages', {}); if (native_.isFailure(result)) { throw native_.getErrorObject(result); @@ -141,6 +146,7 @@ var commonFS_ = (function() { function setVirtualPath(name, path, type, state) { initCache(); cacheVirtualToReal[name] = { path: path, label: name, type: type, state: state }; + userVirtual[name] = { path: path, label: name, type: type, state: state }; } function mergeMultipleSlashes(str) { -- 2.34.1