Browse Source

Merge pull request #272 from dryabov/fix_path_utf8_convert

Fix path utf8 convert
miguelfreitas
miguelfreitas 10 years ago
parent
commit
c1274dcb20
  1. 14
      src/twister.cpp

14
src/twister.cpp

@ -147,8 +147,11 @@ torrent_handle startTorrentUser(std::string const &username, bool following) @@ -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);
@ -272,10 +275,13 @@ void ThreadWaitExtIP() @@ -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;

Loading…
Cancel
Save