Skip to content

Commit

Permalink
Added support for electron original-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kadlecek committed Sep 23, 2015
1 parent eeb7633 commit 3902bb2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions adm-zip.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var fs = require("fs"),
var Utils = require("./util");
var fs = Utils.FileSystem.require(),
pth = require("path");

fs.existsSync = fs.existsSync || pth.existsSync;

var ZipEntry = require("./zipEntry"),
ZipFile = require("./zipFile"),
Utils = require("./util");
ZipFile = require("./zipFile");

module.exports = function(/*String*/input) {
var _zip = undefined,
Expand Down
2 changes: 1 addition & 1 deletion util/fattr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var fs = require("fs"),
var fs = require("./fileSystem").require(),
pth = require("path");

fs.existsSync = fs.existsSync || pth.existsSync;
Expand Down
3 changes: 3 additions & 0 deletions util/fileSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports.require = function() {
return require(process.versions['electron'] ? "original-fs" : "fs");
};
1 change: 1 addition & 0 deletions util/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = require("./utils");
module.exports.FileSystem = require("./fileSystem");
module.exports.Constants = require("./constants");
module.exports.Errors = require("./errors");
module.exports.FileAttr = require("./fattr");
2 changes: 1 addition & 1 deletion util/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var fs = require("fs"),
var fs = require("./fileSystem").require(),
pth = require('path');

fs.existsSync = fs.existsSync || pth.existsSync;
Expand Down
2 changes: 1 addition & 1 deletion zipFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function(/*String|Buffer*/input, /*Number*/inputType) {
entryTable = {},
_comment = new Buffer(0),
filename = "",
fs = require("fs"),
fs = Utils.FileSystem.require(),
inBuffer = null,
mainHeader = new Headers.MainHeader();

Expand Down

0 comments on commit 3902bb2

Please sign in to comment.