From 4d01aa27722f982366d346b80549d52b25a2e72c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 28 Sep 2014 23:36:12 +0800 Subject: [PATCH] Fix shifting args in fs.readFile --- atom/common/lib/asar.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atom/common/lib/asar.coffee b/atom/common/lib/asar.coffee index 839a5122..18b2b4bf 100644 --- a/atom/common/lib/asar.coffee +++ b/atom/common/lib/asar.coffee @@ -135,16 +135,16 @@ fs.readFile = (p, options, callback) -> [isAsar, asarPath, filePath] = splitPath p return readFile.apply this, arguments unless isAsar + if typeof options is 'function' + callback = options + options = undefined + archive = getOrCreateArchive asarPath return callback throw new Error("Invalid package #{asarPath}") unless archive info = archive.getFileInfo filePath return callback createNotFoundError(asarPath, filePath) unless info - if typeof options is 'function' - callback = options - options = undefined - if not options options = encoding: null, flag: 'r' else if util.isString options -- 2.43.0