Browse Source

Windows: fix wrong convertion of path from utf8 to ansi in libtorrent's create_directory (GetDataDir() returns string in correct code page)

miguelfreitas
Denis Ryabov 10 years ago
parent
commit
261219d30f
  1. 8
      src/twister.cpp

8
src/twister.cpp

@ -140,8 +140,8 @@ torrent_handle startTorrentUser(std::string const &username, bool following)
tparams.name = username; tparams.name = username;
boost::filesystem::path torrentPath = GetDataDir() / "swarm"; boost::filesystem::path torrentPath = GetDataDir() / "swarm";
tparams.save_path= torrentPath.string(); tparams.save_path= torrentPath.string();
libtorrent::error_code ec; boost::system::error_code ec;
create_directory(tparams.save_path, ec); boost::filesystem::create_directory(torrentPath, ec);
std::string filename = combine_path(tparams.save_path, to_hex(ih.to_string()) + ".resume"); std::string filename = combine_path(tparams.save_path, to_hex(ih.to_string()) + ".resume");
load_file(filename.c_str(), tparams.resume_data); load_file(filename.c_str(), tparams.resume_data);
@ -265,10 +265,10 @@ void ThreadWaitExtIP()
MilliSleep(500); MilliSleep(500);
} }
libtorrent::error_code ec; libtorrent::error_code ec; // libtorrent::error_code == boost::system::error_code
boost::filesystem::path swarmDbPath = GetDataDir() / "swarm" / "db"; boost::filesystem::path swarmDbPath = GetDataDir() / "swarm" / "db";
create_directories(swarmDbPath.string(), ec); boost::filesystem::create_directories(swarmDbPath, ec);
m_swarmDb.reset(new CLevelDB(swarmDbPath.string(), 256*1024, false, false)); m_swarmDb.reset(new CLevelDB(swarmDbPath.string(), 256*1024, false, false));
int listen_port = GetListenPort() + LIBTORRENT_PORT_OFFSET; int listen_port = GetListenPort() + LIBTORRENT_PORT_OFFSET;

Loading…
Cancel
Save