From 5dd5f18edff7f0e4a52a2c679c3cc3961ecb8af8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 16 Mar 2014 13:24:25 +0800 Subject: [PATCH] Fix process.resourcesPath. --- atom.gyp | 6 +++--- atom/browser/lib/init.coffee | 4 ++-- atom/common/lib/init.coffee | 2 +- atom/common/node_bindings.cc | 3 ++- atom/renderer/lib/init.coffee | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/atom.gyp b/atom.gyp index 70a70bcae4e9..ed4b5bac566d 100644 --- a/atom.gyp +++ b/atom.gyp @@ -290,7 +290,7 @@ ], }, { - 'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources/browser', + 'destination': '<(PRODUCT_DIR)/<(product_name).app/Contents/Resources/atom/browser', 'files': [ 'atom/browser/default_app', ], @@ -328,7 +328,7 @@ ], }, { - 'destination': '<(PRODUCT_DIR)/resources/browser', + 'destination': '<(PRODUCT_DIR)/resources/atom/browser', 'files': [ 'atom/browser/default_app', ] @@ -346,7 +346,7 @@ ], }, { - 'destination': '<(PRODUCT_DIR)/resources/browser', + 'destination': '<(PRODUCT_DIR)/resources/atom/browser', 'files': [ 'atom/browser/default_app', ] diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 42e8df0d2017..fa69de100d08 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -4,7 +4,7 @@ util = require 'util' # Expose information of current process. process.__atom_type = 'browser' -process.resourcesPath = path.resolve process.argv[1], '..', '..', '..' +process.resourcesPath = path.resolve process.argv[1], '..', '..', '..', '..' # We modified the original process.argv to let node.js load the atom.js, # we need to restore it here. @@ -18,7 +18,7 @@ process.execArgv = process.argv.splice startMark, endMark - startMark + 1 # Add browser/api/lib to require's search paths, # which contains javascript part of Atom's built-in libraries. globalPaths = require('module').globalPaths -globalPaths.push path.join process.resourcesPath, 'browser', 'api', 'lib' +globalPaths.push path.join process.resourcesPath, 'atom', 'browser', 'api', 'lib' # Do loading in next tick since we still need some initialize work before # native bindings can work. diff --git a/atom/common/lib/init.coffee b/atom/common/lib/init.coffee index 20d468ee62f7..5e2602ac1805 100644 --- a/atom/common/lib/init.coffee +++ b/atom/common/lib/init.coffee @@ -4,7 +4,7 @@ Module = require 'module' # Add common/api/lib to module search paths. globalPaths = Module.globalPaths -globalPaths.push path.join(process.resourcesPath, 'common', 'api', 'lib') +globalPaths.push path.join(process.resourcesPath, 'atom', 'common', 'api', 'lib') # setImmediate and process.nextTick makes use of uv_check and uv_prepare to # run the callbacks, however since we only run uv loop on requests, the diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 8545f1faecf7..a138273c7105 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -125,7 +125,8 @@ node::Environment* NodeBindings::CreateEnvironment( exec_path.DirName().AppendASCII("resources"); #endif base::FilePath script_path = - resources_path.AppendASCII(is_browser_ ? "browser" : "renderer") + resources_path.AppendASCII("atom") + .AppendASCII(is_browser_ ? "browser" : "renderer") .AppendASCII("lib") .AppendASCII("init.js"); std::string script_path_str = script_path.AsUTF8Unsafe(); diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index cf275f1bb286..33d7d200242a 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -3,7 +3,7 @@ Module = require 'module' # Expose information of current process. process.__atom_type = 'renderer' -process.resourcesPath = path.resolve process.argv[1], '..', '..', '..' +process.resourcesPath = path.resolve process.argv[1], '..', '..', '..', '..' # We modified the original process.argv to let node.js load the # atom-renderer.js, we need to restore it here. @@ -12,7 +12,7 @@ process.argv.splice 1, 1 # Add renderer/api/lib to require's search paths, which contains javascript part # of Atom's built-in libraries. globalPaths = Module.globalPaths -globalPaths.push path.join(process.resourcesPath, 'renderer', 'api', 'lib') +globalPaths.push path.join(process.resourcesPath, 'atom', 'renderer', 'api', 'lib') # And also app. globalPaths.push path.join(process.resourcesPath, 'app')