From de466d15c9c9c4f53e5924b887217a46a5754063 Mon Sep 17 00:00:00 2001
From: Przemyslaw Ciezkowski
Date: Wed, 10 Jun 2015 12:37:18 +0200
Subject: [PATCH] [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
---
src/filesystem/js/common.js | 13 +++++++++++++
src/filesystem/js/file_system_manager.js | 5 ++++-
2 files changed, 17 insertions(+), 1 deletion(-)
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) {
--
2.34.1