You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main/main.cpp
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3182,6 +3182,7 @@ int Main::start() {
3182
3182
3183
3183
#ifdef TOOLS_ENABLED
3184
3184
String doc_tool_path;
3185
+
bool doc_tool_implicit_cwd = false;
3185
3186
BitField<DocTools::GenerateFlags> gen_flags;
3186
3187
String _export_preset;
3187
3188
bool export_debug = false;
@@ -3252,6 +3253,7 @@ int Main::start() {
3252
3253
if (doc_tool_path.begins_with("-")) {
3253
3254
// Assuming other command line arg, so default to cwd.
3254
3255
doc_tool_path = ".";
3256
+
doc_tool_implicit_cwd = true;
3255
3257
parsed_pair = false;
3256
3258
}
3257
3259
#ifdef MODULE_GDSCRIPT_ENABLED
@@ -3282,6 +3284,7 @@ int Main::start() {
3282
3284
// Handle case where no path is given to --doctool.
3283
3285
elseif (args[i] == "--doctool") {
3284
3286
doc_tool_path = ".";
3287
+
doc_tool_implicit_cwd = true;
3285
3288
}
3286
3289
#endif
3287
3290
}
@@ -3308,6 +3311,11 @@ int Main::start() {
3308
3311
{
3309
3312
Ref<DirAccess> da = DirAccess::open(doc_tool_path);
3310
3313
ERR_FAIL_COND_V_MSG(da.is_null(), EXIT_FAILURE, "Argument supplied to --doctool must be a valid directory path.");
3314
+
// Ensure that doctool is running in the root dir, but only if
3315
+
// user did not manually specify a path as argument.
3316
+
if (doc_tool_implicit_cwd) {
3317
+
ERR_FAIL_COND_V_MSG(!da->dir_exists("doc"), EXIT_FAILURE, "--doctool must be run from the Godot repository's root folder, or specify a path that points there.");
0 commit comments