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 648C4105BD for ; Tue, 1 Apr 2014 08:51:19 +0000 (UTC) Received: (qmail 20207 invoked by uid 500); 1 Apr 2014 08:51:19 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 19710 invoked by uid 500); 1 Apr 2014 08:51:16 -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 19052 invoked by uid 99); 1 Apr 2014 08:51:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 08:51:15 +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 anis.kadri@gmail.com designates 209.85.220.50 as permitted sender) Received: from [209.85.220.50] (HELO mail-pa0-f50.google.com) (209.85.220.50) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 08:51:10 +0000 Received: by mail-pa0-f50.google.com with SMTP id kq14so9473242pab.23 for ; Tue, 01 Apr 2014 01:50:50 -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=06ILeGj0qFrvHcGFxL7z0jKJjbatru/qI4VEkNojDXE=; b=wf7dVSFc8yrq+xwm6GKPhEFlsP1wX9jKjkxtkhdFHwl4XEzmowmnK7V9zVwaBUO6Pd r6qQogbu0ggMW7lAXci40WJ/om0YIi2vP1zdMuWfTsDFF4jGUyvxEaQoimWeckw/DCyG A5FupVmH4D27W4Yyzv6mXl7/LU5oBbdlHZZir0q1zOv9If5A7aTUJhb0Slks4/7rIROY 6SPN72Y9a8xUruLPiTlLIgCDvxFKARUAaNu+uPwXsOnaN1mFZz5sVvyWRF5yS6xFSUNd TNNSartcLL+h2TlbP95dKoVyL+rfjRTKC0SJN1GvI9q428WPhFcFYu+IOn+qAOizRkba 4GfA== MIME-Version: 1.0 X-Received: by 10.68.239.137 with SMTP id vs9mr30235665pbc.84.1396342250730; Tue, 01 Apr 2014 01:50:50 -0700 (PDT) Received: by 10.66.144.165 with HTTP; Tue, 1 Apr 2014 01:50:50 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Apr 2014 10:50:50 +0200 Message-ID: Subject: Re: Looking at the new File API pragmatically From: Anis KADRI To: "dev@cordova.apache.org" Content-Type: multipart/alternative; boundary=047d7b33d64ad6fb1104f5f74362 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b33d64ad6fb1104f5f74362 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Apr 1, 2014 at 3:28 AM, Ian Clelland wrote: > On Mon, Mar 31, 2014 at 4:33 PM, Ian Clelland >wrote: > > > On Mon, Mar 31, 2014 at 4:20 PM, Michal Mocny > wrote: > > > >> On Mon, Mar 31, 2014 at 3:39 PM, Ian Clelland >> >wrote: > >> > This is ugly, though, and is going to get worse over time, and become > a > >> > division between Cordova and any platforms which actually implement > the > >> > File API correctly. I'd like to propose switching the behaviour of > >> > .toURL(), to match .toNativeURL -- returning a webview-usable URL by > >> > default -- and implementing some other method or property to get the > CDV > >> > URL when it's necessary. > >> > > >> > >> Everything you've said sounds like its all upside to make the switch. > So > >> I'm curious, when would CDV URL be necessary/useful over file/content > >> urls? > >> > > > > cdvfile:// URLs would still be necessary when dealing with files that > just > > don't *have* an alternate representation. There currently aren't any of > > those, but we could implement virtual file systems entirely inside of a > > plugin, and those would require a cdvfile:// URL to be read. > > > > I think we'd recommend them when saving URLs to persistent storage, if > > there is any chance that the actual files could be moved / migrated, and > we > > could hide that from the user by giving them a more abstract identifier > > than one which specifies a physical location. > > cdvfile://localhost/persistent/my/file.txt might be more durable over > time > > than file:///data/data/com.company.package/files/my/file.txt, perhaps > > across OS upgrades. > > > > Actually, forget all of that. > > Your question had me looking for reasons to advocate users using cdvfile:// > URLs, when perhaps none exist. The truth of the matter is this: The cdvfile > URL has two parts: the filesystem name, and the full path. Those two parts > form a consistent internal representation for all of the types of file that > the plugin can handle, and so all of the internal / native bits of the file > plugin use them almost exclusively. We make sure that every FileEntry and > DirectoryEntry has those parts, and we only need to turn them into a URL > for passing them across the bridge. > > One day someone may discover a great reason to use deliberately use cdvfile > URLs at the application level; until then, they're available, and we can > continue to use them internally to simplify the plugin code, enforce the > sandboxing, and make everything generally more consistent and efficient, > and users shouldn't need to know or care what the URLs in use actually are. > I agree with this as long as the URLs are useable in the WebView (as src attributes for example). If they're not, I also suggest that we return URLs that are useable (file:///, content:/// or whatever) by default. As for filesystems (temp or persistent), I think most developers will use whatever the default is. BUT they should be able to specify where they want to store their data if they feel like it without using a third-party plugin. > > Ian > --047d7b33d64ad6fb1104f5f74362--