From a3bd5e811181dad794209a1f011b78f257649af6 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Tue, 21 Oct 2014 06:07:18 -0700 Subject: [PATCH] 'lime create' patch --- tools/CommandLineTools.hx | 8 ++++---- tools/utils/CreateTemplate.hx | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index 4aa05dbc3..d23f02c23 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -616,17 +616,17 @@ class CommandLineTools { } else { - if (projectName == "") { + if (sampleName == null) { if (FileSystem.exists (PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "samples/" + sampleName))) { CreateTemplate.createSample (words, userDefines); - } else if (PathHelper.getHaxelib (new Haxelib (sampleName)) != "") { + } else if (PathHelper.getHaxelib (new Haxelib (projectName)) != "") { - CreateTemplate.listSamples (sampleName, userDefines); + CreateTemplate.listSamples (projectName, userDefines); - } else if (sampleName == "") { + } else if (projectName == "" || projectName == null) { CreateTemplate.listSamples ("lime", userDefines); diff --git a/tools/utils/CreateTemplate.hx b/tools/utils/CreateTemplate.hx index 84217d5cf..1b2e6b263 100644 --- a/tools/utils/CreateTemplate.hx +++ b/tools/utils/CreateTemplate.hx @@ -237,11 +237,21 @@ class CreateTemplate { PathHelper.mkdir (folder); FileHelper.recursiveCopyTemplate (project.templatePaths, "project", folder, context); - if (FileSystem.exists (folder + "/Project.hxproj")) { + try { - FileSystem.rename (folder + "/Project.hxproj", folder + "/" + title + ".hxproj"); + if (FileSystem.exists (folder + "/Project.hxproj")) { + + if (FileSystem.exists (folder + "/" + title + ".hxproj")) { + + FileSystem.deleteFile (folder + "/" + title + ".hxproj"); + + } + + FileSystem.rename (folder + "/Project.hxproj", folder + "/" + title + ".hxproj"); + + } - } + } catch (e:Dynamic) {} return;