File = function (name, localURL, type, lastModifiedDate, size){ this.name = name || ''; this.localURL = localURL || null; this.type = type || null; this.lastModified = lastModifiedDate || null; // For backwards compatibility, store the timestamp in lastModifiedDate as well this.lastModifiedDate = lastModifiedDate || null; this.size = size || 0; // These store the absolute start and end for slicing the file. this.start = 0; this.end = this.size; }
n/a
File = function (name, localURL, type, lastModifiedDate, size){ this.name = name || ''; this.localURL = localURL || null; this.type = type || null; this.lastModified = lastModifiedDate || null; // For backwards compatibility, store the timestamp in lastModifiedDate as well this.lastModifiedDate = lastModifiedDate || null; this.size = size || 0; // These store the absolute start and end for slicing the file. this.start = 0; this.end = this.size; }
n/a
slice = function (start, end) { var size = this.end - this.start; var newStart = 0; var newEnd = size; if (arguments.length) { if (start < 0) { newStart = Math.max(size + start, 0); } else { newStart = Math.min(size, start); } } if (arguments.length >= 2) { if (end < 0) { newEnd = Math.max(size + end, 0); } else { newEnd = Math.min(end, size); } } var newFile = new File(this.name, this.localURL, this.type, this.lastModified, this.size); newFile.start = this.start + newStart; newFile.end = this.start + newEnd; return newFile; }
...
* Use TRAVIS_BUILD_DIR, install paramedic by npm
* docs: added Windows to supported platforms
* [CB-8699](https://issues.apache.org/jira/browse/CB-8699) [CB-6428](https://issues.apache.org/jira/browse/CB-6428) Fix uncompressed
assets being copied as zero length files
* [CB-6428](https://issues.apache.org/jira/browse/CB-6428) android: Fix assets FileEntry having size of -1
* android: Move URLforFullPath into base class (and rename to localUrlforFullPath)
* [CB-6428](https://issues.apache.org/jira/browse/CB-6428) Mention build-extras.gradle in README
* [CB-7109](https://issues.apache.org/jira/browse/CB-7109) android: Parse arguments off of the main thread (close #97)
* [CB-8695](https://issues.apache.org/jira/browse/CB-8695) ios: Fix `blob.slice()` for
`asset-library` URLs (close #105)
* Tweak build-extras.gradle to just read/write to main `assets/` instead of `build/`
* [CB-8689](https://issues.apache.org/jira/browse/CB-8689) Fix NPE in makeEntryForNativeUri (was affecting file-transfer)
* [CB-8675](https://issues.apache.org/jira/browse/CB-8675) Revert "CB-8351 ios: Use base64EncodedStringWithOptions instead
of CordovaLib's class extension"
* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) Updated Readme
* [CB-8659](https://issues.apache.org/jira/browse/CB-8659): ios: 4.0.x Compatibility: Remove use of initWebView method
* Add a cache to speed up AssetFilesystem directory listings
* [CB-8663](https://issues.apache.org/jira/browse/CB-8663) android: Don't notify MediaScanner of private files
...
__format__ = function (fullPath, nativeUrl) { var path; var contentUrlMatch = /^content:\/\//.exec(nativeUrl); if (contentUrlMatch) { // When available, use the path from a native content URL, which was already encoded by Android. // This is necessary because JavaScript's encodeURI() does not encode as many characters as // Android, which can result in permission exceptions when the encoding of a content URI // doesn't match the string for which permission was originally granted. path = nativeUrl.substring(contentUrlMatch[0].length - 1); } else { path = FileSystem.encodeURIPath(fullPath); if (!/^\//.test(path)) { path = '/' + path; } var m = /\?.*/.exec(nativeUrl); if (m) { path += m[0]; } } return FILESYSTEM_PROTOCOL + '://localhost/' + this.name + path; }
...
};
/**
* Return a URL that can be passed across the bridge to identify this entry.
*/
Entry.prototype.toInternalURL = function() {
if (this.filesystem && this.filesystem.__format__) {
return this.filesystem.__format__(this.fullPath, this.nativeURL);
}
};
/**
* Return a URL that can be used to identify this entry.
* Use a URL that can be used to as the src attribute of a <video> or
* <audio> tag. If that is not possible, construct a cdvfile:// URL.
...
getFs = function (name, callback) { callback(null); }
...
if (type < 0) {
fail(FileError.SYNTAX_ERR);
} else {
// if successful, return a FileSystem object
var success = function(file_system) {
if (file_system) {
if (successCallback) {
fileSystems.getFs(file_system.name, function(fs) {
// This should happen only on platforms that haven't implemented requestAllFileSystems (windows)
if (!fs) {
fs = new FileSystem(file_system.name, file_system.root);
}
successCallback(fs);
});
}
...
getHomePath = function (success, fail, args, env) { var homeDir = window.qnx.webplatform.getApplication().getEnv("HOME"); new PluginResult(args, env).ok(homeDir); }
n/a
requestAllPaths = function (success, fail, args, env) { var homeDir = 'file://' + window.qnx.webplatform.getApplication().getEnv("HOME").replace('/data', ''), paths = { applicationDirectory: homeDir + '/app/native/', applicationStorageDirectory: homeDir + '/', dataDirectory: homeDir + '/data/webviews/webfs/persistent/local__0/', cacheDirectory: homeDir + '/data/webviews/webfs/temporary/local__0/', externalRootDirectory: 'file:///accounts/1000/removable/sdcard/', sharedDirectory: homeDir + '/shared/' }; success(paths); }
n/a
setSandbox = function (success, fail, args, env) { require("lib/webview").setSandbox(JSON.parse(decodeURIComponent(args[0]))); new PluginResult(args, env).ok(); }
...
*
*/
/* global PluginResult */
module.exports = {
setSandbox : function (success, fail, args, env) {
require("lib/webview").setSandbox(JSON.parse(decodeURIComponent(args[0])));
new PluginResult(args, env).ok();
},
getHomePath: function (success, fail, args, env) {
var homeDir = window.qnx.webplatform.getApplication().getEnv("HOME");
new PluginResult(args, env).ok(homeDir);
},
...