mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Rename path variables to prevent collisions
This commit is contained in:
@@ -60,18 +60,18 @@ class PackageGeneratorView extends View
|
||||
templatePath = fsUtils.resolveOnLoadPath(path.join("package-generator", "template"))
|
||||
packageName = path.basename(@getPackagePath())
|
||||
|
||||
for path in fsUtils.listTree(templatePath)
|
||||
relativePath = path.replace(templatePath, "")
|
||||
for templateChildPath in fsUtils.listTree(templatePath)
|
||||
relativePath = templateChildPath.replace(templatePath, "")
|
||||
relativePath = relativePath.replace(/^\//, '')
|
||||
relativePath = relativePath.replace(/\.template$/, '')
|
||||
relativePath = @replacePackageNamePlaceholders(relativePath, packageName)
|
||||
|
||||
sourcePath = path.join(@getPackagePath(), relativePath)
|
||||
if fsUtils.isDirectory(path)
|
||||
if fsUtils.isDirectory(templateChildPath)
|
||||
fsUtils.makeTree(sourcePath)
|
||||
if fsUtils.isFile(path)
|
||||
if fsUtils.isFile(templateChildPath)
|
||||
fsUtils.makeTree(path.dirname(sourcePath))
|
||||
content = @replacePackageNamePlaceholders(fsUtils.read(path), packageName)
|
||||
content = @replacePackageNamePlaceholders(fsUtils.read(templateChildPath), packageName)
|
||||
fsUtils.write(sourcePath, content)
|
||||
|
||||
replacePackageNamePlaceholders: (string, packageName) ->
|
||||
|
||||
@@ -274,19 +274,19 @@ class TreeView extends ScrollView
|
||||
|
||||
onConfirm: (relativePath) =>
|
||||
endsWithDirectorySeparator = /\/$/.test(relativePath)
|
||||
path = project.resolve(relativePath)
|
||||
pathToCreate = project.resolve(relativePath)
|
||||
try
|
||||
if fsUtils.exists(path)
|
||||
pathType = if fsUtils.isFile(path) then "file" else "directory"
|
||||
if fsUtils.exists(pathToCreate)
|
||||
pathType = if fsUtils.isFile(pathToCreate) then "file" else "directory"
|
||||
dialog.showError("Error: A #{pathType} already exists at path '#{path}'. Try a different path.")
|
||||
else if endsWithDirectorySeparator
|
||||
fsUtils.makeTree(path)
|
||||
fsUtils.makeTree(pathToCreate)
|
||||
dialog.cancel()
|
||||
@entryForPath(path).buildEntries()
|
||||
@selectEntryForPath(path)
|
||||
@entryForPath(pathToCreate).buildEntries()
|
||||
@selectEntryForPath(pathToCreate)
|
||||
else
|
||||
fsUtils.write(path, "")
|
||||
rootView.open(path)
|
||||
fsUtils.write(pathToCreate, "")
|
||||
rootView.open(pathToCreate)
|
||||
dialog.close()
|
||||
catch e
|
||||
dialog.showError("Error: #{e.message} Try a different path.")
|
||||
|
||||
Reference in New Issue
Block a user