Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Directory Reader bug and fix proxy for electron #387

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-file",
"version": "6.0.3-dev",
"version": "6.0.4",
"description": "Cordova File Plugin",
"types": "./types/index.d.ts",
"cordova": {
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-file"
version="6.0.3-dev">
version="6.0.4">
<name>File</name>
<description>Cordova File Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,file</keywords>
<repo>https://github.com/apache/cordova-plugin-file</repo>
<repo>https://github.com/jammer99/cordova-plugin-file</repo>
<issue>https://github.com/apache/cordova-plugin-file/issues</issue>

<engines>
Expand Down
2 changes: 1 addition & 1 deletion src/browser/FileProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

// For chrome we don't need to implement proxy methods
// All functionality can be accessed natively.
if (require('./isChrome')()) {
if (cordova.platformId === 'browser' && require('./isChrome')()) {
var pathsPrefix = {
// Read-only directory where the application is installed.
applicationDirectory: location.origin + '/', // eslint-disable-line no-undef
Expand Down
10 changes: 8 additions & 2 deletions www/DirectoryReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var FileError = require('./FileError');
/**
* An interface that lists the files and directories in a directory.
*/
function DirectoryReader (localURL) {
function DirectoryReader(localURL) {
this.localURL = localURL || null;
this.hasReadEntries = false;
}
Expand All @@ -46,6 +46,12 @@ DirectoryReader.prototype.readEntries = function (successCallback, errorCallback
var win = typeof successCallback !== 'function' ? null : function (result) {
var retVal = [];
for (var i = 0; i < result.length; i++) {
var fs;
if (typeof result[i].filesystem !== 'undefined') {
fs = result[i].filesystem.name;
} else {
fs = result[i].filesystemName;
}
var entry = null;
if (result[i].isDirectory) {
entry = new (require('./DirectoryEntry'))();
Expand All @@ -56,7 +62,7 @@ DirectoryReader.prototype.readEntries = function (successCallback, errorCallback
entry.isFile = result[i].isFile;
entry.name = result[i].name;
entry.fullPath = result[i].fullPath;
entry.filesystem = new (require('./FileSystem'))(result[i].filesystemName);
entry.filesystem = new (require('./FileSystem'))(fs);
entry.nativeURL = result[i].nativeURL;
retVal.push(entry);
}
Expand Down