Skip to content

Commit

Permalink
Load CoffeeScript when using a custom resource path
Browse files Browse the repository at this point in the history
Load CoffeeScript early whenever the resource path a subdirectory
from process.resourcesPath

Close atom#3993
  • Loading branch information
kevinsawicki committed Oct 29, 2014
1 parent 3df72ec commit 0c590d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/module-cache.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ resolveModulePath = (relativePath, parentModule) ->
return

registerBuiltins = (devMode) ->
if devMode
if devMode or not cache.resourcePath.startsWith("#{process.resourcesPath}#{path.sep}")
fs = require 'fs-plus'
atomCoffeePath = path.join(cache.resourcePath, 'exports', 'atom.coffee')
cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath)
Expand Down
6 changes: 4 additions & 2 deletions static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ window.onload = function() {
// Skip "?loadSettings=".
var loadSettings = JSON.parse(decodeURIComponent(location.search.substr(14)));

var devMode = loadSettings.devMode || !loadSettings.resourcePath.startsWith(process.resourcesPath + require('path').sep);

// Require before the module cache in dev mode
if (loadSettings.devMode) {
if (devMode) {
require('coffee-script').register();
}

Expand All @@ -25,7 +27,7 @@ window.onload = function() {

require('vm-compatibility-layer');

if (!loadSettings.devMode) {
if (!devMode) {
require('coffee-script').register();
}

Expand Down

0 comments on commit 0c590d6

Please sign in to comment.