fix the truncate bug Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/51111243 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/51111243 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/51111243
Branch: refs/heads/master Commit: 5111124333263f6a44971ba2a636b3b055abaf21 Parents: e8734fb Author: wangmingfeng <mingfengwan...@gmail.com> Authored: Thu Sep 27 14:43:56 2012 +0800 Committer: wangmingfeng <mingfengwan...@gmail.com> Committed: Thu Sep 27 14:43:56 2012 +0800 ---------------------------------------------------------------------- lib/windows8/plugin/windows8/FileProxy.js | 27 ++++++++++------------- 1 files changed, 12 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/51111243/lib/windows8/plugin/windows8/FileProxy.js ---------------------------------------------------------------------- diff --git a/lib/windows8/plugin/windows8/FileProxy.js b/lib/windows8/plugin/windows8/FileProxy.js index 45185c7..606d53d 100644 --- a/lib/windows8/plugin/windows8/FileProxy.js +++ b/lib/windows8/plugin/windows8/FileProxy.js @@ -439,24 +439,21 @@ module.exports = { var name = storageFile.name; var entry = new Entry(true, false, name, fullPath); var parentPath = ""; - do { - var successCallBack = function (entry) { - parentPath = entry.fullPath; - }; - entry.getParent(successCallBack, null); - } - while (parentPath === ""); - storageFile.deleteAsync().then(function () { - Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) { - storageFolder.createFileAsync(name).then(function (newStorageFile) { - Windows.Storage.FileIO.writeTextAsync(newStorageFile, fileContent).done(function () { - win(String(fileContent).length); - }, function () { - fail(FileError.NO_MODIFICATION_ALLOWED_ERR); + var successCallBack = function (entry) { + parentPath = entry.fullPath; + storageFile.deleteAsync().then(function () { + Windows.Storage.StorageFolder.getFolderFromPathAsync(parentPath).then(function (storageFolder) { + storageFolder.createFileAsync(name).then(function (newStorageFile) { + Windows.Storage.FileIO.writeTextAsync(newStorageFile, fileContent).done(function () { + win(String(fileContent).length); + }, function () { + fail(FileError.NO_MODIFICATION_ALLOWED_ERR); + }); }); }); }); - }); + }; + entry.getParent(successCallBack, null); }, function () { fail(FileError.NOT_FOUND_ERR); }); } });