Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D16611670 for ; Mon, 12 May 2014 14:46:34 +0000 (UTC) Received: (qmail 20022 invoked by uid 500); 12 May 2014 14:46:33 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 19999 invoked by uid 500); 12 May 2014 14:46:33 -0000 Mailing-List: contact commits-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 commits@cordova.apache.org Received: (qmail 19992 invoked by uid 99); 12 May 2014 14:46:33 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 May 2014 14:46:33 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C790881D9CF; Mon, 12 May 2014 14:46:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ian@apache.org To: commits@cordova.apache.org Message-Id: <8fbca66fb8ef4d6fb796fd4c2adf3e41@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: Rename misCapitaliZed js file for improved installability (This closes #12) Date: Mon, 12 May 2014 14:46:32 +0000 (UTC) Repository: cordova-plugins Updated Branches: refs/heads/master 437c10b42 -> 7003b2882 Rename misCapitaliZed js file for improved installability (This closes #12) Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/7003b288 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/7003b288 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/7003b288 Branch: refs/heads/master Commit: 7003b2882346ba1e26122290211d47d18b7f0760 Parents: 437c10b Author: Ian Clelland Authored: Mon May 12 10:46:05 2014 -0400 Committer: Ian Clelland Committed: Mon May 12 10:46:05 2014 -0400 ---------------------------------------------------------------------- file-system-roots/FileSystemRoots.js | 88 +++++++++++++++++++++++++++++++ file-system-roots/filesystemroots.js | 88 ------------------------------- 2 files changed, 88 insertions(+), 88 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/7003b288/file-system-roots/FileSystemRoots.js ---------------------------------------------------------------------- diff --git a/file-system-roots/FileSystemRoots.js b/file-system-roots/FileSystemRoots.js new file mode 100644 index 0000000..13ded3e --- /dev/null +++ b/file-system-roots/FileSystemRoots.js @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +var exec = require('cordova/exec'); +var argscheck = require('cordova/argscheck'); + + +// Open Discussion: +// * Should we have a purpose to expose the assets? +// * Would it be any different from resolveLocalFileSystemURL('/') +// * Should we instead expose URLs instead of DirectoryEntry objects? +// * e.g. On iOS, app-data://icloud=yes/, app-documents://icloud=no/, app-temp://, app-bundle:// +// * e.g. On Android, could use same schemes for 3.0+, or use content://cordova-app/app-data://... for 2.3 +// * This would mean APIs could be synchronous, and platform-specific locations can be kept on native side. +// * This would allow things to be used as URLs for images. +// * APIs (such as FileTransfer) work better with URLs (Paths are annoying, esp with Windows using \) +// * Entry have a toURL() already. Without custom schemes, it won't work for Android resources & assets +// * Add support resolveLocalFileSystemURL()? + + +var Purpose = { + 'data': 0, // General application data (default) + 'documents': 1, // Files that are meaningful to other applciations (e.g. Office files) + 'cache': 2, // Temporary files that should survive app restarts + 'temp': 3, // Files that can should be deleted on app restarts + 'app-bundle': 4 // The application bundle (iOS only) +}; + +/** + * Supplies a DirectoryEntry that matches the given constraints to the given callback. + */ +exports.getDirectoryForPurpose = function(purpose, options, successCallback, failureCallback) { + argscheck.checkArgs('sOfF', 'cordova.filesystem.getDirectoryForPurpose', arguments); + var augmentedSuccessCallback = successCallback && function(fullPath) { + resolveLocalFileSystemURL(fullPath, successCallback, failureCallback); + }; + + var purposeInt = Purpose[purpose]; + if (typeof purposeInt == 'undefined') { + throw new Error('getDirectoryForPurpose: invalid purpose: ' + purpose); + } + options = options || {}; + + var sandboxed = typeof options.sandboxed == 'undefined' ? true : !!options.sandboxed; + var syncable = typeof options.syncable == 'undefined' ? true : !!options.syncable; + + var args = [purposeInt, sandboxed, syncable]; + exec(augmentedSuccessCallback, failureCallback, "FileSystemRoots", "getDirectoryForPurpose", args); +}; + +exports.getDataDirectory = function(syncable, successCallback) { + argscheck.checkArgs('*f', 'cordova.filesystem.getDataDirectory', arguments); + exports.getDirectoryForPurpose('data', { syncable: syncable }, successCallback); +}; + +exports.getDocumentsDirectory = function(successCallback) { + exports.getDirectoryForPurpose('documents', { syncable: true, sandboxed: false }, successCallback); +}; + +exports.getTempDirectory = function(successCallback) { + exports.getDirectoryForPurpose('temp', null, successCallback); +}; + +exports.getCacheDirectory = function(successCallback) { + exports.getDirectoryForPurpose('cache', null, successCallback); +}; + +exports.getFileSystemRoot = function(fileSystemName, successCallback, failureCallback) { + argscheck.checkArgs('sfF', 'cordova.filesystem.getFileSystemRoot', arguments); + resolveLocalFileSystemURL('cdvfile://localhost/'+fileSystemName+'/', successCallback, failureCallback); +}; http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/7003b288/file-system-roots/filesystemroots.js ---------------------------------------------------------------------- diff --git a/file-system-roots/filesystemroots.js b/file-system-roots/filesystemroots.js deleted file mode 100644 index 13ded3e..0000000 --- a/file-system-roots/filesystemroots.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * -*/ - -var exec = require('cordova/exec'); -var argscheck = require('cordova/argscheck'); - - -// Open Discussion: -// * Should we have a purpose to expose the assets? -// * Would it be any different from resolveLocalFileSystemURL('/') -// * Should we instead expose URLs instead of DirectoryEntry objects? -// * e.g. On iOS, app-data://icloud=yes/, app-documents://icloud=no/, app-temp://, app-bundle:// -// * e.g. On Android, could use same schemes for 3.0+, or use content://cordova-app/app-data://... for 2.3 -// * This would mean APIs could be synchronous, and platform-specific locations can be kept on native side. -// * This would allow things to be used as URLs for images. -// * APIs (such as FileTransfer) work better with URLs (Paths are annoying, esp with Windows using \) -// * Entry have a toURL() already. Without custom schemes, it won't work for Android resources & assets -// * Add support resolveLocalFileSystemURL()? - - -var Purpose = { - 'data': 0, // General application data (default) - 'documents': 1, // Files that are meaningful to other applciations (e.g. Office files) - 'cache': 2, // Temporary files that should survive app restarts - 'temp': 3, // Files that can should be deleted on app restarts - 'app-bundle': 4 // The application bundle (iOS only) -}; - -/** - * Supplies a DirectoryEntry that matches the given constraints to the given callback. - */ -exports.getDirectoryForPurpose = function(purpose, options, successCallback, failureCallback) { - argscheck.checkArgs('sOfF', 'cordova.filesystem.getDirectoryForPurpose', arguments); - var augmentedSuccessCallback = successCallback && function(fullPath) { - resolveLocalFileSystemURL(fullPath, successCallback, failureCallback); - }; - - var purposeInt = Purpose[purpose]; - if (typeof purposeInt == 'undefined') { - throw new Error('getDirectoryForPurpose: invalid purpose: ' + purpose); - } - options = options || {}; - - var sandboxed = typeof options.sandboxed == 'undefined' ? true : !!options.sandboxed; - var syncable = typeof options.syncable == 'undefined' ? true : !!options.syncable; - - var args = [purposeInt, sandboxed, syncable]; - exec(augmentedSuccessCallback, failureCallback, "FileSystemRoots", "getDirectoryForPurpose", args); -}; - -exports.getDataDirectory = function(syncable, successCallback) { - argscheck.checkArgs('*f', 'cordova.filesystem.getDataDirectory', arguments); - exports.getDirectoryForPurpose('data', { syncable: syncable }, successCallback); -}; - -exports.getDocumentsDirectory = function(successCallback) { - exports.getDirectoryForPurpose('documents', { syncable: true, sandboxed: false }, successCallback); -}; - -exports.getTempDirectory = function(successCallback) { - exports.getDirectoryForPurpose('temp', null, successCallback); -}; - -exports.getCacheDirectory = function(successCallback) { - exports.getDirectoryForPurpose('cache', null, successCallback); -}; - -exports.getFileSystemRoot = function(fileSystemName, successCallback, failureCallback) { - argscheck.checkArgs('sfF', 'cordova.filesystem.getFileSystemRoot', arguments); - resolveLocalFileSystemURL('cdvfile://localhost/'+fileSystemName+'/', successCallback, failureCallback); -};