Compiles
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@ -30,7 +30,7 @@ void print_help() {
|
||||
std::cout << " help Show this help message" << std::endl;
|
||||
std::cout << " init DIR Add DIR as a local server config directory (can add several)" << std::endl;
|
||||
|
||||
if (get_global_config()->is_config_set()) {
|
||||
if (gConfig().is_config_set()) {
|
||||
std::cout << " server NAME Show details for specific server" << std::endl;
|
||||
std::cout << " templates List all available templates" << std::endl;
|
||||
std::cout << std::endl;
|
||||
@ -86,9 +86,8 @@ std::string safearg(int argc, char *argv[], int index)
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
dropshell::config *cfg = dropshell::get_global_config();
|
||||
// silently attempt to load the config file.
|
||||
cfg->load_config();
|
||||
dropshell::gConfig().load_config();
|
||||
|
||||
if (argc < 2) {
|
||||
dropshell::print_help();
|
||||
@ -115,17 +114,18 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
if (cmd == "edit" && argc < 3) {
|
||||
std::filesystem::create_directories(dropshell::get_local_dropshell_config_parent_path());
|
||||
dropshell::edit_file(dropshell::get_local_dropshell_config_file(), "Please ensure any directories you have introduced in the config file exist.");
|
||||
std::string config_file = dropshell::localfile::dropshell_conf();
|
||||
std::filesystem::create_directories( dropshell::get_parent(config_file) );
|
||||
dropshell::edit_file(config_file, "Please ensure any directories you have introduced in the config file exist.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// from here we require the config file to be loaded.
|
||||
if (!cfg->is_config_set())
|
||||
if (!dropshell::gConfig().is_config_set())
|
||||
return die("Please run 'dropshell init <path>' to initialise the user directory and create a configuration file.");
|
||||
|
||||
const std::vector<std::string> & local_config_directories = cfg->get_local_config_directories();
|
||||
const std::vector<std::string> & local_config_directories = dropshell::gConfig().get_local_config_directories();
|
||||
std::cout << "Config directories: ";
|
||||
for (auto & dir : local_config_directories)
|
||||
std::cout << "["<< dir << "] ";
|
||||
|
Reference in New Issue
Block a user