]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix shifting args in fs.readFile
authorCheng Zhao <zcbenz@gmail.com>
Sun, 28 Sep 2014 15:36:12 +0000 (23:36 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sun, 28 Sep 2014 15:36:12 +0000 (23:36 +0800)
atom/common/lib/asar.coffee

index 839a512213d67853dd0384796bb22f0bf4d64cc5..18b2b4bfb4873ebc6efb7fcefa3ad0ef9e2814ec 100644 (file)
@@ -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