summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-10 12:12:47 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-10 12:12:47 -0600
commit448b1a47d454376b24cf7baf52306d3c7e3900ae (patch)
tree79aadb41e36ce177b154750c94292f670b77efe7
parentf3294e59e10b2d408367ea236e4d35a3590e6bfe (diff)
parent8379cc85aad36c6224a7eb163773fe25ca3c811b (diff)
downloadredot-engine-448b1a47d454376b24cf7baf52306d3c7e3900ae.tar.gz
Merge pull request #98895 from Calinou/warn-unknown-cli-arguments
Warn on unknown command line arguments
-rw-r--r--main/main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
index e8086db9d3..fb21ee502f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1801,6 +1801,13 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (arg == "--" || arg == "++") {
adding_user_args = true;
} else {
+ if (!FileAccess::exists(arg) && !DirAccess::exists(arg)) {
+ // Warn if the argument isn't recognized by Godot *and* the file/folder
+ // specified by a positional argument doesn't exist.
+ // This allows projects to read file or folder paths as a positional argument
+ // without printing a warning, as this scenario can't make use of user command line arguments.
+ WARN_PRINT(vformat("Unknown command line argument \"%s\". User arguments should be passed after a -- or ++ separator, e.g. \"-- %s\".", arg, arg));
+ }
main_args.push_back(arg);
}