Skip to content

Commit

Permalink
Merge pull request #272 from dryabov/fix_path_utf8_convert
Browse files Browse the repository at this point in the history
Fix path utf8 convert
  • Loading branch information
miguelfreitas committed Sep 21, 2014
2 parents 146a932 + edbc39f commit c1274dc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/twister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ torrent_handle startTorrentUser(std::string const &username, bool following)
tparams.name = username;
boost::filesystem::path torrentPath = GetDataDir() / "swarm";
tparams.save_path= torrentPath.string();
libtorrent::error_code ec;
create_directory(tparams.save_path, ec);
boost::system::error_code ec;
boost::filesystem::create_directory(torrentPath, ec);
if (ec) {
fprintf(stderr, "failed to create directory '%s': %s\n", torrentPath.string().c_str(), ec.message().c_str());
}
std::string filename = combine_path(tparams.save_path, to_hex(ih.to_string()) + ".resume");
load_file(filename.c_str(), tparams.resume_data);

Expand Down Expand Up @@ -272,10 +275,13 @@ void ThreadWaitExtIP()
MilliSleep(500);
}

libtorrent::error_code ec;
libtorrent::error_code ec; // libtorrent::error_code == boost::system::error_code

boost::filesystem::path swarmDbPath = GetDataDir() / "swarm" / "db";
create_directories(swarmDbPath.string(), ec);
boost::filesystem::create_directories(swarmDbPath, ec);
if (ec) {
fprintf(stderr, "failed to create directory '%s': %s\n", swarmDbPath.string().c_str(), ec.message().c_str());
}
m_swarmDb.reset(new CLevelDB(swarmDbPath.string(), 256*1024, false, false));

int listen_port = GetListenPort() + LIBTORRENT_PORT_OFFSET;
Expand Down

0 comments on commit c1274dc

Please sign in to comment.