Browse Source

rename function

master
Jørgen Sverre Lien Sellæg 5 years ago
parent
commit
774dab5bab
  1. 2
      include/data.hpp
  2. 6
      src/data.cpp

2
include/data.hpp

@ -9,7 +9,7 @@ class with_data_directory {
public: public:
with_data_directory(); with_data_directory();
static const fs::path &get_data_path(); static const fs::path &get_path();
}; };
class data_validator { class data_validator {

6
src/data.cpp

@ -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();
} }

Loading…
Cancel
Save