Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1EA03DCD1 for ; Sat, 6 Oct 2012 09:19:24 +0000 (UTC) Received: (qmail 11957 invoked by uid 500); 6 Oct 2012 09:19:23 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 11886 invoked by uid 500); 6 Oct 2012 09:19:22 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 10922 invoked by uid 99); 6 Oct 2012 09:19:21 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Oct 2012 09:19:21 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B28553AD39; Sat, 6 Oct 2012 09:19:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [13/45] js commit: fix the truncate bug Message-Id: <20121006091920.B28553AD39@tyr.zones.apache.org> Date: Sat, 6 Oct 2012 09:19:20 +0000 (UTC) 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 Authored: Thu Sep 27 14:43:56 2012 +0800 Committer: wangmingfeng 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); }); } });