Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Normalize command line paths with windows drive letters #16745

Merged
merged 1 commit into from Feb 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/main-process/atom-application.js
Expand Up @@ -838,13 +838,12 @@ class AtomApplication extends EventEmitter {
let existingWindow
if (!newWindow) {
existingWindow = this.windowForPaths(pathsToOpen, devMode)
const stats = pathsToOpen.map(pathToOpen => fs.statSyncNoException(pathToOpen))
if (!existingWindow) {
let lastWindow = window || this.getLastFocusedWindow()
if (lastWindow && lastWindow.devMode === devMode) {
if (addToLastWindow || (
stats.every(s => s.isFile && s.isFile()) ||
(stats.some(s => s.isDirectory && s.isDirectory()) && !lastWindow.hasProjectPath()))) {
locationsToOpen.every(({stat}) => stat && stat.isFile()) ||
(locationsToOpen.some(({stat}) => stat && stat.isDirectory()) && !lastWindow.hasProjectPath()))) {
existingWindow = lastWindow
}
}
Expand Down Expand Up @@ -1267,11 +1266,11 @@ class AtomApplication extends EventEmitter {
initialLine = initialColumn = null
}

if (url.parse(pathToOpen).protocol == null) {
pathToOpen = path.resolve(executedFrom, fs.normalize(pathToOpen))
}
const normalizedPath = path.normalize(path.resolve(executedFrom, fs.normalize(pathToOpen)))
const stat = fs.statSyncNoException(normalizedPath)
if (stat) pathToOpen = normalizedPath

return {pathToOpen, initialLine, initialColumn}
return {pathToOpen, stat, initialLine, initialColumn}
}

// Opens a native dialog to prompt the user for a path.
Expand Down