forked from premiere/premiere-libtorrent
made it build on cygwin
This commit is contained in:
parent
b38a3119a1
commit
df4466cb86
|
@ -32,11 +32,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
#include "libtorrent/file.hpp"
|
#include "libtorrent/file.hpp"
|
||||||
#include "libtorrent/utf8.hpp"
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// windows part
|
// windows part
|
||||||
|
#include "libtorrent/utf8.hpp"
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -143,7 +144,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
assert(path.is_complete());
|
assert(path.is_complete());
|
||||||
close();
|
close();
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
std::wstring wpath(safe_convert(path.native_file_string()));
|
std::wstring wpath(safe_convert(path.native_file_string()));
|
||||||
m_fd = ::_wopen(
|
m_fd = ::_wopen(
|
||||||
wpath.c_str()
|
wpath.c_str()
|
||||||
|
|
|
@ -70,7 +70,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/file.hpp"
|
#include "libtorrent/file.hpp"
|
||||||
#include "libtorrent/invariant_check.hpp"
|
#include "libtorrent/invariant_check.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <boost/filesystem/exception.hpp>
|
#include <boost/filesystem/exception.hpp>
|
||||||
|
@ -330,7 +330,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
path f = p / i->path;
|
path f = p / i->path;
|
||||||
size = file_size(f);
|
size = file_size(f);
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
time = last_write_time_win(f);
|
time = last_write_time_win(f);
|
||||||
#else
|
#else
|
||||||
time = last_write_time(f);
|
time = last_write_time(f);
|
||||||
|
@ -366,7 +366,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
path f = p / i->path;
|
path f = p / i->path;
|
||||||
size = file_size(f);
|
size = file_size(f);
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
time = last_write_time_win(f);
|
time = last_write_time_win(f);
|
||||||
#else
|
#else
|
||||||
time = last_write_time(f);
|
time = last_write_time(f);
|
||||||
|
@ -481,7 +481,7 @@ namespace libtorrent
|
||||||
|
|
||||||
save_path = complete(save_path);
|
save_path = complete(save_path);
|
||||||
|
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
std::wstring wsave_path(safe_convert(save_path.native_file_string()));
|
std::wstring wsave_path(safe_convert(save_path.native_file_string()));
|
||||||
if (!exists_win(save_path))
|
if (!exists_win(save_path))
|
||||||
{
|
{
|
||||||
|
@ -505,7 +505,7 @@ namespace libtorrent
|
||||||
path single_file = m_pimpl->info.begin_files()->path;
|
path single_file = m_pimpl->info.begin_files()->path;
|
||||||
if (single_file.has_branch_path())
|
if (single_file.has_branch_path())
|
||||||
{
|
{
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
std::wstring wsave_path(safe_convert((save_path / single_file.branch_path())
|
std::wstring wsave_path(safe_convert((save_path / single_file.branch_path())
|
||||||
.native_directory_string()));
|
.native_directory_string()));
|
||||||
CreateDirectory(wsave_path.c_str(), 0);
|
CreateDirectory(wsave_path.c_str(), 0);
|
||||||
|
@ -526,7 +526,7 @@ namespace libtorrent
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
rename_win(old_path, new_path);
|
rename_win(old_path, new_path);
|
||||||
#else
|
#else
|
||||||
rename(old_path, new_path);
|
rename(old_path, new_path);
|
||||||
|
@ -1338,7 +1338,7 @@ namespace libtorrent
|
||||||
if (dir == last_path) continue;
|
if (dir == last_path) continue;
|
||||||
last_path = dir;
|
last_path = dir;
|
||||||
|
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(_WIN32) && defined(UNICODE)
|
||||||
if (!exists_win(last_path))
|
if (!exists_win(last_path))
|
||||||
create_directories_win(last_path);
|
create_directories_win(last_path);
|
||||||
#else
|
#else
|
||||||
|
@ -1346,23 +1346,6 @@ namespace libtorrent
|
||||||
create_directories(last_path);
|
create_directories(last_path);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// first, create all missing directories
|
|
||||||
|
|
||||||
for (torrent_info::file_iterator file_iter = m_info.begin_files(),
|
|
||||||
end_iter = m_info.end_files(); file_iter != end_iter; ++file_iter)
|
|
||||||
{
|
|
||||||
path dir = m_save_path / file_iter->path;
|
|
||||||
|
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
|
||||||
if (!exists_win(dir.branch_path()))
|
|
||||||
create_directories_win(dir.branch_path());
|
|
||||||
#else
|
|
||||||
if (!exists(dir.branch_path()))
|
|
||||||
create_directories(dir.branch_path());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
std::vector<char> piece_data(static_cast<int>(m_info.piece_length()));
|
std::vector<char> piece_data(static_cast<int>(m_info.piece_length()));
|
||||||
|
|
||||||
// this maps a piece hash to piece index. It will be
|
// this maps a piece hash to piece index. It will be
|
||||||
|
|
Loading…
Reference in New Issue