|
|
|
@ -2,7 +2,7 @@ |
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
|
#include <unistd.h> |
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
|
|
|
|
const fs::path &with_data_directory::get_data_path() { |
|
|
|
const fs::path &with_data_directory::get_path() { |
|
|
|
static fs::path p(""); |
|
|
|
static fs::path p(""); |
|
|
|
if (p.native().length() != 0) { |
|
|
|
if (p.native().length() != 0) { |
|
|
|
return p; |
|
|
|
return p; |
|
|
|
@ -17,14 +17,14 @@ const fs::path &with_data_directory::get_data_path() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
with_data_directory::with_data_directory() { |
|
|
|
with_data_directory::with_data_directory() { |
|
|
|
if (!fs::exists(get_data_path())) { |
|
|
|
if (!fs::exists(get_path())) { |
|
|
|
create_data_directory(); |
|
|
|
create_data_directory(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void with_data_directory::create_data_directory() { |
|
|
|
void with_data_directory::create_data_directory() { |
|
|
|
std::error_code ec; |
|
|
|
std::error_code ec; |
|
|
|
fs::create_directories(get_data_path(), ec); |
|
|
|
fs::create_directories(get_path(), ec); |
|
|
|
if (ec) { |
|
|
|
if (ec) { |
|
|
|
std::cerr << "Unable to create data directory:\n" << ec.message(); |
|
|
|
std::cerr << "Unable to create data directory:\n" << ec.message(); |
|
|
|
} |
|
|
|
} |
|
|
|
|