Skip to content

Commit

Permalink
Merge pull request #247 from zp/data-path
Browse files Browse the repository at this point in the history
Create data_path on configuration load
  • Loading branch information
vktr committed Apr 26, 2016
2 parents 03b8b5d + d2af91f commit cc442b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/client/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ void configuration::set<int>(const char *name, int value)
void configuration::load()
{
std::string data_path = environment::get_data_path();

if (!pal::directory_exists(data_path))
{
pal::create_directories(data_path);
}

std::string config_file = pal::combine_paths(data_path, "PicoTorrent.json");

if (!pal::file_exists(config_file))
Expand Down Expand Up @@ -443,7 +449,7 @@ std::shared_ptr<configuration::placement> configuration::window_placement(const
}

pj::array a = v.get<pj::array>();

auto wp = std::make_shared<placement>();
wp->flags = (uint32_t)a[0].get<int64_t>();
wp->max_x = (long)a[1].get<int64_t>();
Expand Down

0 comments on commit cc442b5

Please sign in to comment.