Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B954610BF7 for ; Tue, 4 Mar 2014 11:17:25 +0000 (UTC) Received: (qmail 1431 invoked by uid 500); 4 Mar 2014 11:17:25 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 1354 invoked by uid 500); 4 Mar 2014 11:17:25 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 1213 invoked by uid 99); 4 Mar 2014 11:17:23 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2014 11:17:23 +0000 Date: Tue, 4 Mar 2014 11:17:23 +0000 (UTC) From: "Ralph S Theart (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-6148) wrong filesystem properties in entry after moveTo() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-6148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919264#comment-13919264 ] Ralph S Theart commented on CB-6148: ------------------------------------ Also moveTo continues to fail even after trying #dev and the new code...sigh I don't get it...why does it keep failing. I've tried everything...were you able to reproduce this error as well? > wrong filesystem properties in entry after moveTo() > --------------------------------------------------- > > Key: CB-6148 > URL: https://issues.apache.org/jira/browse/CB-6148 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File > Affects Versions: 3.4.0 > Environment: iOS6 > iOS7 > Reporter: Dominik Pesch > Assignee: Ian Clelland > > To store pictures persistent in our app, we move the image files from the temporary folder to the persistent folder. The code breaks after upgrading to Cordova 3.4.0 and file plugin 1.0.0 (and 1.0.1). > We've found that the filesystem object in the moveTo success callback entry parameter has got wrong value (please notice pseudo code below). > Below you'll see the Xcode log output: > {noformat} > 2014-03-02 21:31:43.672 Finanzchecker[509:907] fileSys.name: persistent > 2014-03-02 21:31:43.682 Finanzchecker[509:907] fileSys.root.name: / > 2014-03-02 21:31:43.687 Finanzchecker[509:907] fileSys.root.fullPath: / > 2014-03-02 21:31:43.717 Finanzchecker[509:907] dir.name: pics > 2014-03-02 21:31:43.726 Finanzchecker[509:907] dir.fullPath: /pics/ > 2014-03-02 21:31:43.778 Finanzchecker[509:907] newFileEntry.name: pic1393792303602.jpg > 2014-03-02 21:31:43.784 Finanzchecker[509:907] newFileEntry.fullPath: /pics/pic1393792303602.jpg > 2014-03-02 21:31:43.796 Finanzchecker[509:907] newFileEntry.nativeURL: file:///var/mobile/Applications/82A8A0EF-8012-4D7E-B78D-EA3A4C2B7CBF/Documents/pics/pic1393792303602.jpg > 2014-03-02 21:31:43.802 Finanzchecker[509:907] newFileEntry.toURL(): cdvfile://localhost/temporary/pics/pic1393792303602.jpg > 2014-03-02 21:31:43.815 Finanzchecker[509:907] newFileEntry.filesystem.name: temporary > 2014-03-02 21:31:43.820 Finanzchecker[509:907] newFileEntry.filesystem.root.name: '/' > 2014-03-02 21:31:43.820 Finanzchecker[509:907] newFileEntry.filesystem.root.fullPath: '/' > {noformat} > *Our problem:* > We had expected that newFileEntry.filesystem.name has to be 'persistent' (instead it is 'temporary') . newFileEntry.toURL returns the wrong cdvfile URL (please see Xcode output above). > {code:JavaScript|title=Shortened pseudo code:|borderStyle=solid} > // ... will be called from navigator.camera.getPicture(...) > function picSuccess(imageUrl) > { > window.resolveLocalFileSystemURL(imageUrl, _fileEntrySuccess, _handleFileError); > function _fileEntrySuccess(tmpFileEntry) > { > var newFileName = "pic" + new Date().getTime() + '.jpg'; > window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) > { > console.log("fileSys.name: " + fileSys.name); > console.log("fileSys.root.name: " + fileSys.root.name); > console.log("fileSys.root.fullPath: " + fileSys.root.fullPath); > fileSys.root.getDirectory("pics", { create: true, exclusive: false }, function(dir) > { > console.log("dir.name: " + dir.name); > console.log("dir.fullPath: " + dir.fullPath); > tmpFileEntry.moveTo(dir, newFileName, function(newFileEntry) > { > console.log("newFileEntry.name: " + newFileEntry.name); > console.log("newFileEntry.fullPath: " + newFileEntry.fullPath); > console.log("newFileEntry.nativeURL: " + newFileEntry.nativeURL); > console.log("newFileEntry.toURL(): " + newFileEntry.toURL()); > console.log("newFileEntry.filesystem.name: " + newFileEntry.filesystem.name); > console.log("newFileEntry.filesystem.fullPath: " + newFileEntry.filesystem.fullPath); > _fileMovedSuccess(newFileEntry); > }, _handleFileError) > }) > }, > _handleFileError); > } > function _fileMovedSuccess(entry) > { > // ... > } > } > {code} > We've tested this with Cordova 3.4.0 and cordova file plugin 1.0.0 and 1.0.1 (https://github.com/apache/cordova-plugin-file.git 21e119692ab9c9fb2912dc69e2c6d4b05307e3e2). > // corrected the example (some typos) -- This message was sent by Atlassian JIRA (v6.2#6252)