Normalize resource path drive letters in main

This commit is contained in:
Max Brunsfeld
2015-09-01 11:54:58 -07:00
parent 5be3d4f82f
commit 61f7de736f
3 changed files with 12 additions and 17 deletions

View File

@@ -65,13 +65,6 @@ class AtomApplication
constructor: (options) ->
{@resourcePath, @version, @devMode, @safeMode, @socketPath} = options
# Normalize to make sure drive letter case is consistent on Windows
if @resourcePath
if process.platform is 'win32'
@resourcePath = @resourcePath.replace /^([a-z]):/, ([driveLetter]) ->
"#{driveLetter.toUpperCase()}:"
@resourcePath = path.normalize(@resourcePath)
global.atomApplication = this
@pidsToOpenWindows = {}

View File

@@ -23,9 +23,6 @@ class AtomWindow
locationsToOpen ?= [{pathToOpen}] if pathToOpen
locationsToOpen ?= []
# Normalize to make sure drive letter case is consistent on Windows
@resourcePath = path.normalize(@resourcePath) if @resourcePath
options =
show: false
title: 'Atom'

View File

@@ -54,17 +54,20 @@ start = ->
else
path.resolve(pathToOpen)
if args.devMode
AtomApplication = require path.join(args.resourcePath, 'src', 'browser', 'atom-application')
else
AtomApplication = require './atom-application'
AtomApplication = require path.join(args.resourcePath, 'src', 'browser', 'atom-application')
AtomApplication.open(args)
console.log("App load time: #{Date.now() - global.shellStartTime}ms") unless args.test
global.devResourcePath = process.env.ATOM_DEV_RESOURCE_PATH ? path.join(app.getHomeDir(), 'github', 'atom')
# Normalize to make sure drive letter case is consistent on Windows
global.devResourcePath = path.normalize(global.devResourcePath) if global.devResourcePath
normalizeDriveLetterName = (filePath) ->
if process.platform is 'win32'
filePath.replace /^([a-z]):/, ([driveLetter]) -> driveLetter.toUpperCase() + ":"
else
filePath
global.devResourcePath = normalizeDriveLetterName(
process.env.ATOM_DEV_RESOURCE_PATH ? path.join(app.getHomeDir(), 'github', 'atom')
)
setupCrashReporter = ->
crashReporter.start(productName: 'Atom', companyName: 'GitHub')
@@ -164,6 +167,8 @@ parseCommandLine = ->
# explicitly pass it by command line, see http://git.io/YC8_Ew.
process.env.PATH = args['path-environment'] if args['path-environment']
resourcePath = normalizeDriveLetterName(resourcePath)
{resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed,
devMode, safeMode, newWindow, specDirectory, logFile, socketPath, profileStartup}