From 54427f6eeaec0ccf6c82b8d3a569d910a2ace8b4 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Mon, 2 Nov 2026 06:57:21 +1100 Subject: [PATCH 1/2] CLI: an empty value right before the project path (-t"" path) keeps the path; only -p with no path is an error --- commandLine/src/main.cpp | 16 ++++++++++++---- scripts/test_cmdline_args.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/commandLine/src/main.cpp b/commandLine/src/main.cpp index fe74e36b..7fcd63d2 100644 --- a/commandLine/src/main.cpp +++ b/commandLine/src/main.cpp @@ -478,20 +478,22 @@ int pgMain(int argc, char ** argv) { argv += (argc > 0); // skip program name argv[0] if present // optionparser only takes attached values (-posx, --platforms=osx); join -p osx / --platforms osx, - // but leave the last argument as the project path (-f is an empty -f) + // but leave the last argument as the project path: -t"" (scripts, the GUI) is an empty -t static const std::string valueShort { "paotsmfDPkW" }; static const std::vector valueLong { "platforms", "addons", "ofPath", "template", "source", "ofmenu", "frameworks", "system-libs", "defines", "postbuild", "msys2env", "emscripten-wasm", "app-version", "app-build", "bundle-id" }; std::vector joinedArgs; + std::string platformBeforePath; for (int i = 0; i < argc; i++) { std::string a { argv[i] }; bool isValueOption = (a.size() == 2 && a[0] == '-' && valueShort.find(a[1]) != std::string::npos) || (a.rfind("--", 0) == 0 && std::find(valueLong.begin(), valueLong.end(), a.substr(2)) != valueLong.end()); - // only -f / --frameworks / --system-libs mean something empty (remove), so -f keeps the path - bool emptyMeansRemove = a == "-f" || a == "--frameworks" || a == "--system-libs"; - if (isValueOption && i + 1 < argc && argv[i + 1][0] != '-' && (i + 2 < argc || !emptyMeansRemove)) { + bool keyword = a == "-m" || a == "--ofmenu"; // status / update-libs, no project path after it + if (isValueOption && i + 1 < argc && argv[i + 1][0] != '-' && (i + 2 < argc || keyword)) { joinedArgs.emplace_back(a + (a.size() == 2 ? "" : "=") + argv[i + 1]); i++; } else { + // -p osx with no project path: osx would be taken as the project + if ((a == "-p" || a == "--platforms") && i + 2 == argc && argv[i + 1][0] != '-') platformBeforePath = argv[i + 1]; joinedArgs.emplace_back(a); } } @@ -758,6 +760,12 @@ int pgMain(int argc, char ** argv) { messageError("Missing project path"); return EXIT_USAGE; } + if (!platformBeforePath.empty() && projectName == platformBeforePath && getTargetProject(platformBeforePath) && !fs::exists(fs::current_path() / projectName)) { + printHelp(); + consoleSpace(); + messageError("Missing project path (\"" + projectName + "\" after -p is the platform) - eg -p" + projectName + " path/to/myApp"); + return EXIT_USAGE; + } fs::path projectPath = normalizePath(fs::weakly_canonical(fs::current_path() / projectName)); fs::path projectNamePath = projectPath.filename(); diff --git a/scripts/test_cmdline_args.sh b/scripts/test_cmdline_args.sh index a4522383..2f445eca 100755 --- a/scripts/test_cmdline_args.sh +++ b/scripts/test_cmdline_args.sh @@ -180,6 +180,18 @@ pg -o .. -p "$PLATFORM" -a ofxGui -D A=1 -P "echo done" -s myApps/pgArgTests/sha expect_exit 0; expect_updated; expect_no_stray grep -q ofxGui "$APP_DIR/addons.make" 2>/dev/null || fail "addons.make has no ofxGui" +start "empty values before the path, as OF's CI scripts: -a\"\" -p\"$PLATFORM\" -t\"\" path (was: path taken as the template)" +pg -o"$OF" -v -a"" -p"$PLATFORM" -t"" "$APP" +expect_exit 0; expect_updated; expect_no_stray + +start "bare -t right before the path, as the GUI with no template (was: path taken as the template)" +pg -o.. -a -p"$PLATFORM" -t "$APP" +expect_exit 0; expect_updated; expect_no_stray + +start "empty separate values: -a \"\" -t \"\" path" +pg -o.. -p"$PLATFORM" -a "" -t "" "$APP" +expect_exit 0; expect_updated; expect_no_stray + start "project path only (host platform, OF path from -o)" pg -o.. "$APP" expect_exit 0; expect_no_stray From 5cdc8d2e1bc1313191e33b417f659a7d992cb964 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Mon, 2 Nov 2026 11:53:01 +1100 Subject: [PATCH 2/2] Updated cmdLine from 0.122.0 to 0.123.0 and PG GUI from 0.117.0 to 0.118.0 --- commandLine/src/defines.h | 2 +- frontend/npm-shrinkwrap.json | 4 ++-- frontend/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commandLine/src/defines.h b/commandLine/src/defines.h index 42340f3c..4efe1dd8 100644 --- a/commandLine/src/defines.h +++ b/commandLine/src/defines.h @@ -1,5 +1,5 @@ #define OFPROJECTGENERATOR_MAJOR_VERSION "0" -#define OFPROJECTGENERATOR_MINOR_VERSION "122" +#define OFPROJECTGENERATOR_MINOR_VERSION "123" #define OFPROJECTGENERATOR_PATCH_VERSION "0" #define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION) diff --git a/frontend/npm-shrinkwrap.json b/frontend/npm-shrinkwrap.json index 876124a0..4506e480 100644 --- a/frontend/npm-shrinkwrap.json +++ b/frontend/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "projectGenerator", - "version": "0.117.0", + "version": "0.118.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "projectGenerator", - "version": "0.117.0", + "version": "0.118.0", "license": "MIT", "dependencies": { "@types/jquery": "^3.5.34", diff --git a/frontend/package.json b/frontend/package.json index be42d0c4..5f157803 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "projectGenerator", "productName": "projectGenerator", - "version": "0.117.0", + "version": "0.118.0", "description": "Build electron GUI openFrameworks projectGenerator", "license": "MIT", "main": "index.js",