mirror of
https://github.com/godotengine/godot.git
synced 2025-02-16 15:50:45 +00:00
Doctool: Add error checks and exit code handling
This commit is contained in:
parent
846c14eee9
commit
99cd4afb2b
@ -2091,6 +2091,7 @@ bool Main::start() {
|
|||||||
GLOBAL_DEF("mono/runtime/unhandled_exception_policy", 0);
|
GLOBAL_DEF("mono/runtime/unhandled_exception_policy", 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Error err;
|
||||||
DocTools doc;
|
DocTools doc;
|
||||||
doc.generate(doc_base);
|
doc.generate(doc_base);
|
||||||
|
|
||||||
@ -2112,34 +2113,42 @@ bool Main::start() {
|
|||||||
|
|
||||||
// Create the module documentation directory if it doesn't exist
|
// Create the module documentation directory if it doesn't exist
|
||||||
DirAccess *da = DirAccess::create_for_path(path);
|
DirAccess *da = DirAccess::create_for_path(path);
|
||||||
da->make_dir_recursive(path);
|
err = da->make_dir_recursive(path);
|
||||||
memdelete(da);
|
memdelete(da);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != OK, false, "Error: Can't create directory: " + path + ": " + itos(err));
|
||||||
|
|
||||||
docsrc.load_classes(path);
|
|
||||||
print_line("Loading docs from: " + path);
|
print_line("Loading docs from: " + path);
|
||||||
|
err = docsrc.load_classes(path);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != OK, false, "Error loading docs from: " + path + ": " + itos(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String index_path = doc_tool_path.plus_file("doc/classes");
|
String index_path = doc_tool_path.plus_file("doc/classes");
|
||||||
// Create the main documentation directory if it doesn't exist
|
// Create the main documentation directory if it doesn't exist
|
||||||
DirAccess *da = DirAccess::create_for_path(index_path);
|
DirAccess *da = DirAccess::create_for_path(index_path);
|
||||||
da->make_dir_recursive(index_path);
|
err = da->make_dir_recursive(index_path);
|
||||||
memdelete(da);
|
memdelete(da);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != OK, false, "Error: Can't create index directory: " + index_path + ": " + itos(err));
|
||||||
|
|
||||||
docsrc.load_classes(index_path);
|
print_line("Loading classes from: " + index_path);
|
||||||
|
err = docsrc.load_classes(index_path);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != OK, false, "Error loading classes from: " + index_path + ": " + itos(err));
|
||||||
checked_paths.insert(index_path);
|
checked_paths.insert(index_path);
|
||||||
print_line("Loading docs from: " + index_path);
|
|
||||||
|
|
||||||
print_line("Merging docs...");
|
print_line("Merging docs...");
|
||||||
doc.merge_from(docsrc);
|
doc.merge_from(docsrc);
|
||||||
|
|
||||||
for (Set<String>::Element *E = checked_paths.front(); E; E = E->next()) {
|
for (Set<String>::Element *E = checked_paths.front(); E; E = E->next()) {
|
||||||
print_line("Erasing old docs at: " + E->get());
|
print_line("Erasing old docs at: " + E->get());
|
||||||
DocTools::erase_classes(E->get());
|
err = DocTools::erase_classes(E->get());
|
||||||
|
ERR_FAIL_COND_V_MSG(err != OK, false, "Error erasing old docs at: " + E->get() + ": " + itos(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
print_line("Generating new docs...");
|
print_line("Generating new docs...");
|
||||||
doc.save_classes(index_path, doc_data_classes);
|
err = doc.save_classes(index_path, doc_data_classes);
|
||||||
|
ERR_FAIL_COND_V_MSG(err != OK, false, "Error saving new docs:" + itos(err));
|
||||||
|
|
||||||
|
OS::get_singleton()->set_exit_code(EXIT_SUCCESS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user