diff --git a/Tools/capp/Generate.j b/Tools/capp/Generate.j index 0afc58eaa..276ed6161 100644 --- a/Tools/capp/Generate.j +++ b/Tools/capp/Generate.j @@ -12,6 +12,7 @@ function gen(/*va_args*/) shouldSymbolicallyLink = false, justFrameworks = false, noConfig = false, + force = false, template = "Application", destination = ""; @@ -37,6 +38,9 @@ function gen(/*va_args*/) case "--noconfig": noConfig = true; break; + case "--force": force = true; + break; + default: destination = argument; } } @@ -49,7 +53,7 @@ function gen(/*va_args*/) configuration = noConfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration]; if (justFrameworks) - createFrameworksInFile(destinationProject, shouldSymbolicallyLink); + createFrameworksInFile(destinationProject, shouldSymbolicallyLink, force); else if (!destinationProject.exists()) { @@ -89,10 +93,23 @@ function gen(/*va_args*/) } -function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLink) +function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLink, /*Boolean*/ force) { var destinationFrameworks = new java.io.File(aFile.getCanonicalPath()+ "/Frameworks"), destinationDebugFrameworks = new java.io.File(aFile.getCanonicalPath() + "/Frameworks/Debug"); + + if (destinationFrameworks.exists()) { + if (force) { + print("Updating existing Frameworks directory."); + exec(["rm", "-rf", destinationFrameworks.getCanonicalPath()], true); + } + else { + print("Frameworks directory already exists. Use --force to overwrite."); + return; + } + } else { + print("Creating Frameworks directory."); + } if (!shouldSymbolicallyLink) { @@ -100,7 +117,7 @@ function createFrameworksInFile(/*File*/ aFile, /*Boolean*/ shouldSymbolicallyLi exec(["cp", "-R", sourceFrameworks.getCanonicalPath(), destinationFrameworks.getCanonicalPath()], true); - return true; + return; } var BUILD = system.env["CAPP_BUILD"] || system.env["STEAM_BUILD"]; diff --git a/Tools/capp/main.j b/Tools/capp/main.j index fb751c9a4..34d30702a 100644 --- a/Tools/capp/main.j +++ b/Tools/capp/main.j @@ -48,6 +48,7 @@ function printUsage() print(" -l Symlink the Frameworks folder to your $CAPP_BUILD or $STEAM_BUILD directory"); print(" -t, --template Specify the template name to use (listed in capp/Resources/Templates)"); print(" -f, --frameworks Create only frameworks, not a full application"); + print(" --force Overwrite Frameworks directory if it already exists"); print(""); print(ANSITextApplyProperties(" config ", ANSI_BOLD)); print(" name value Set a value for a given key");