var _pathTokens = aPath.split('/');
- if (cacheVirtualToReal[_pathTokens[0]] && (
- cacheVirtualToReal[_pathTokens[0]].state === undefined ||
- cacheVirtualToReal[_pathTokens[0]].state === FileSystemStorageState.MOUNTED)) {
+ if (cacheVirtualToReal[_pathTokens[0]]) {
_fileRealPath = cacheVirtualToReal[_pathTokens[0]].path;
for (var i = 1; i < _pathTokens.length; ++i) {
_fileRealPath += '/' + _pathTokens[i];
_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)) {
+ if (cacheStorages[j].label === _pathTokens[0]) {
_fileRealPath = cacheStorages[j].path;
for (var i = 1; i < _pathTokens.length; ++i) {
_fileRealPath += '/' + _pathTokens[i];
}, 0);
return;
}
+
+ // resolving a path on unmounted storage should result in exception
+ var storage = commonFS_.getStorage(args.location.split('/')[0]);
+ if (storage && FileSystemStorageState.MOUNTED !== storage.state) {
+ setTimeout(function() {
+ native_.callIfPossible(args.onerror,
+ new WebAPIException(WebAPIException.NOT_FOUND_ERR,
+ 'Storage is not mounted.'));
+ }, 0);
+ return;
+ }
+
var _realPath = commonFS_.toRealPath(args.location);
var _isLocationAllowed = commonFS_.isLocationAllowed(_realPath);