From: Przemyslaw Ciezkowski Date: Wed, 10 Jun 2015 10:37:18 +0000 (+0200) Subject: [Filesystem] Allow to resolve storages X-Git-Tag: submit/tizen/20150702.103311^2~2^2~32^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de466d15c9c9c4f53e5924b887217a46a5754063;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Filesystem] Allow to resolve storages Current implementation doesn't allow to resolve storages. Without this commit nothing happens when resolving storage. [Verification] Run this code with sdcard attached: tizen.resolve("removable1", function(dir) { console.log("Resolved, full path: " + dir.fullPath); }, function(e) { console.log("Error: " + e.message); }, "r"); TCT pass rate doesn't change: TV: 1 Fail Mobile: 100% Change-Id: Id0f6326d6a4fad32e9ce691c3b56fa2ac5396f5e Signed-off-by: Przemyslaw Ciezkowski --- diff --git a/src/filesystem/js/common.js b/src/filesystem/js/common.js index 1fe845d0..cae012c3 100755 --- a/src/filesystem/js/common.js +++ b/src/filesystem/js/common.js @@ -83,6 +83,7 @@ var commonFS_ = (function() { var storages = native_.getResultObject(result); for (var i = 0; i < storages.length; ++i) { cacheStorages.push({ + path: storages[i].path, label: storages[i].name, type: storages[i].type, state: storages[i].state, @@ -126,6 +127,18 @@ var commonFS_ = (function() { } else { //If path token is not present in cache then it is invalid _fileRealPath = undefined; + // check storages + for (var j = 0; j < cacheStorages.length; ++j) { + if (cacheStorages[j].label === _pathTokens[0] && ( + cacheStorages[j].state === undefined || + cacheStorages[j].state === FileSystemStorageState.MOUNTED)) { + _fileRealPath = cacheStorages[j].path; + for (var i = 1; i < _pathTokens.length; ++i) { + _fileRealPath += '/' + _pathTokens[i]; + } + break; + } + } } } else { _fileRealPath = aPath; diff --git a/src/filesystem/js/file_system_manager.js b/src/filesystem/js/file_system_manager.js index d883a2fd..05960754 100755 --- a/src/filesystem/js/file_system_manager.js +++ b/src/filesystem/js/file_system_manager.js @@ -83,7 +83,10 @@ FileSystemManager.prototype.resolve = function(location, onsuccess, onerror, mod } }; - native_.call('File_stat', data, callback); + var ret = native_.call('File_stat', data, callback); + if (native_.isFailure(ret)) { + throw native_.getErrorObject(ret); + } }; FileSystemManager.prototype.getStorage = function(label, onsuccess, onerror) {