You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2013/05/25 03:11:27 UTC

[2/2] wp7 commit: Allow app names with spaces

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/64b5b0dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp7/tree/64b5b0dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp7/diff/64b5b0dd

Branch: refs/heads/3.0.0
Commit: 64b5b0dde8fca90869fac65e1941189bdc4fb5c6
Parents: 70da4b2
Author: Benn Mapes <be...@gmail.com>
Authored: Fri May 24 18:01:19 2013 -0700
Committer: Benn Mapes <be...@gmail.com>
Committed: Fri May 24 18:01:19 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/64b5b0dd/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