Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9465210169 for ; Wed, 16 Apr 2014 19:43:32 +0000 (UTC) Received: (qmail 7121 invoked by uid 500); 16 Apr 2014 19:43:29 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 7062 invoked by uid 500); 16 Apr 2014 19:43:29 -0000 Mailing-List: contact dev-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 dev@cordova.apache.org Received: (qmail 7041 invoked by uid 99); 16 Apr 2014 19:43:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2014 19:43:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of purplecabbage@gmail.com designates 209.85.220.170 as permitted sender) Received: from [209.85.220.170] (HELO mail-vc0-f170.google.com) (209.85.220.170) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2014 19:43:24 +0000 Received: by mail-vc0-f170.google.com with SMTP id hu19so11684109vcb.1 for ; Wed, 16 Apr 2014 12:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=IZ88jcfbc//1zUIH3/ihwax869wh8Do2XZKfxAUbvlo=; b=ACXW8YVBsbPgiJem5wkHuCPtWFyqM3iKU82WSVpLrSoFMz7v3KCavmlVYNxt5EznGu mFd1ZYHCFYGe8C0mA5l6PbxsjE5slrnHsAa94nMv+Nj+mraSo37bWMfRILGPEFsZB4yI 9LDZOtfumlZlIDoGOHAKEmo7IQMQML1R24w9MtwBYtl8lu4Eg++zlv+qFiQx5FAebKSh bohfEqYARt/vk1vw/3GRX532Z5TkEPdRak5GHWRVJO2q2d6iNOgCNE3ykBeo+e19lCOH wdBJWw2eDN59bOB8heKeNPCA+4gWByY4PhT8vg/uNvxgZrJlDt/nFTKdkmJl0S0ABle6 OgGA== MIME-Version: 1.0 X-Received: by 10.221.29.137 with SMTP id ry9mr4465780vcb.6.1397677384034; Wed, 16 Apr 2014 12:43:04 -0700 (PDT) Received: by 10.58.169.73 with HTTP; Wed, 16 Apr 2014 12:43:03 -0700 (PDT) In-Reply-To: References: <5892923C-448D-41F6-A8DA-FA660A7FF6F7@gmail.com> Date: Wed, 16 Apr 2014 12:43:03 -0700 Message-ID: Subject: Re: should FileTransfer.download() auto mkdir target's path? From: Jesse To: "dev@cordova.apache.org" Content-Type: multipart/alternative; boundary=001a1133935cfc724c04f72e1fed X-Virus-Checked: Checked by ClamAV on apache.org --001a1133935cfc724c04f72e1fed Content-Type: text/plain; charset=UTF-8 Can't find the original issue, but it was specific to file and not file-transfer... >From the File Spec [1] ( which is somewhat inherited by the File transfer plugin ) + It is an error to attempt to create a directory whose immediate parent does not yet exist. + It is an error to attempt to create a file whose immediate parent does not yet exist. Whether we view the file-transfer plugin as a high level helper that hides these details, or as a strict extension to the File plugin is up for discussion. [1] http://www.w3.org/TR/2011/WD-file-system-api-20110419/ @purplecabbage risingj.com On Wed, Apr 16, 2014 at 12:32 PM, Jesse wrote: > Originally WP8 was creating any missing intermediate folders, but this was > raised as a defect because the spec explicitly states it should produce an > error in this case. > Trying to dig up the issue ... > > > @purplecabbage > risingj.com > > > On Wed, Apr 16, 2014 at 12:07 PM, James Jong wrote: > >> I think iOS attempts to create the directory first. >> >> https://github.com/apache/cordova-plugin-file-transfer/blob/master/src/ios/CDVFileTransfer.m#L660 >> -James Jong >> >> On Apr 16, 2014, at 2:58 PM, Shazron wrote: >> >> > Additional info: >> > iOS will not create intermediate folders for download(), they must >> already >> > exist >> > (based on my tests with NSFileManager >> createFileAtPath:contents:attributes >> > call that is used by FileTransfer.download()) >> > >> > >> > On Wed, Apr 16, 2014 at 10:57 AM, Mike Billau >> wrote: >> > >> >> Hello, >> >> >> >> When using FileTransfer.download(), if the target location contains >> folders >> >> that do not exist on the device, should FileTransfer auto-magically >> mkdir >> >> these folders to save the download? >> >> >> >> If target= /foo/image.png, and if /foo/ doesn't exist, Android will >> create >> >> the /foo/ dir for you. WP8 doesn't seem to do this and will instead >> return >> >> with an error. I don't know which implementation should be considered >> >> "correct." It seems like a "good" dev should first check that the >> target >> >> exists and create it before saving the image, but I'm all for making >> things >> >> easier for the developer and just doing it auto-magically (I hate that >> >> word...) >> >> >> >> I'm using 3.1 btw, sigh and sorry! Thanks everyone for your opinions. >> >> >> >> > --001a1133935cfc724c04f72e1fed--