From: Cheng Zhao Date: Sun, 28 Sep 2014 15:36:12 +0000 (+0800) Subject: Fix shifting args in fs.readFile X-Git-Tag: v0.17.0~6^2~22 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=4d01aa27722f982366d346b80549d52b25a2e72c;p=electron.git Fix shifting args in fs.readFile --- 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