mirror of
https://github.com/atom/atom.git
synced 2026-02-18 10:31:54 -05:00
relativize to atom project
This commit is contained in:
@@ -145,8 +145,12 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
const config = contents.config
|
||||
const originPath = atomProject
|
||||
if (paths != null) {
|
||||
pathsToOpen = pathsToOpen.concat(paths)
|
||||
const relativizedPaths = paths.map((curPath) =>
|
||||
relativizeToAtomProject(curPath, atomProject, executedFrom)
|
||||
)
|
||||
pathsToOpen = pathsToOpen.concat(relativizedPaths)
|
||||
}
|
||||
console.log(pathsToOpen)
|
||||
projectSettings = { originPath, paths, config }
|
||||
}
|
||||
|
||||
@@ -213,6 +217,11 @@ const hasAtomProjectFormat = (atomProject) => {
|
||||
return projectFileFormat.test(atomProject)
|
||||
}
|
||||
|
||||
const relativizeToAtomProject = (curPath, atomProject, executedFrom) => {
|
||||
const projectPath = path.isAbsolute(atomProject) ? atomProject : path.join(executedFrom, atomProject)
|
||||
return path.join(path.dirname(projectPath), curPath)
|
||||
}
|
||||
|
||||
const normalizeDriveLetterName = (filePath) => {
|
||||
if (process.platform === 'win32') {
|
||||
return filePath.replace(/^([a-z]):/, ([driveLetter]) => driveLetter.toUpperCase() + ':')
|
||||
|
||||
Reference in New Issue
Block a user