Allow app names with spaces

Project: http://git-wip-us.apache.org/repos/asf/cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp7/commit/890045fa
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp7/tree/890045fa
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp7/diff/890045fa

Branch: refs/heads/3.0.0
Commit: 890045fae9eee73dc2df6defc73d65984a5bded4
Parents: 4d05619
Author: Benn Mapes <[email protected]>
Authored: Fri May 24 18:01:19 2013 -0700
Committer: Benn Mapes <[email protected]>
Committed: Mon May 27 17:12:58 2013 -0700

----------------------------------------------------------------------
 bin/create.js |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/890045fa/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index 7d89d0a..d8b67a9 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -171,11 +171,12 @@ function create(path, namespace, name) {
     replaceInFile(path + "\\MainPage.xaml",/\$safeprojectname\$/g,namespace);
     replaceInFile(path + 
"\\MainPage.xaml.cs",/\$safeprojectname\$/g,namespace);
     replaceInFile(path + 
"\\CordovaAppProj.csproj",/\$safeprojectname\$/g,namespace);
-    if (NAME != "CordovaAppProj") {
-        replaceInFile(path + "\\CordovaSolution.sln",/CordovaAppProj/g,NAME);
+    if (name != "CordovaAppProj") {
+        var valid_name = name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_');
+        replaceInFile(path + "\\CordovaSolution.sln", /CordovaAppProj/g, 
valid_name);
         // rename project and solution
-        exec('%comspec% /c ren ' + path + "\\CordovaSolution.sln " + NAME + 
'.sln');
-        exec('%comspec% /c ren ' + path + "\\CordovaAppProj.csproj " + NAME + 
'.csproj');
+        exec('%comspec% /c ren ' + path + "\\CordovaSolution.sln " + 
valid_name + '.sln');
+        exec('%comspec% /c ren ' + path + "\\CordovaAppProj.csproj " + 
valid_name + '.csproj');
     }
 
     //copy .dll if necessary

Reply via email to