Rename path variables to prevent collisions

This commit is contained in:
Kevin Sawicki
2013-06-12 17:59:37 -07:00
parent 87e60bd0eb
commit bab9bd7550
2 changed files with 13 additions and 13 deletions

View File

@@ -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) ->

View File

@@ -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.")