*** empty log message ***
This commit is contained in:
@@ -121,6 +121,27 @@ namespace
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool exists_win( const path & ph )
|
||||||
|
{
|
||||||
|
std::wstring wsave_path(safe_convert(ph.string()));
|
||||||
|
if(::GetFileAttributes( wsave_path.c_str() ) == 0xFFFFFFFF)
|
||||||
|
{
|
||||||
|
UINT err = ::GetLastError();
|
||||||
|
if((err == ERROR_FILE_NOT_FOUND)
|
||||||
|
|| (err == ERROR_INVALID_PARAMETER)
|
||||||
|
|| (err == ERROR_NOT_READY)
|
||||||
|
|| (err == ERROR_PATH_NOT_FOUND)
|
||||||
|
|| (err == ERROR_INVALID_NAME)
|
||||||
|
|| (err == ERROR_BAD_NETPATH ))
|
||||||
|
return false; // GetFileAttributes failed because the path does not exist
|
||||||
|
// for any other error we assume the file does exist and fall through,
|
||||||
|
// this may not be the best policy though... (JM 20040330)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::time_t last_write_time_win( const path & ph )
|
std::time_t last_write_time_win( const path & ph )
|
||||||
{
|
{
|
||||||
// Works for both Windows and POSIX
|
// Works for both Windows and POSIX
|
||||||
@@ -461,9 +482,9 @@ 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()));
|
if (!exists_win(save_path))
|
||||||
if (GetFileAttributes(wsave_path.c_str()) == INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
{
|
||||||
|
std::wstring wsave_path(safe_convert(save_path.native_file_string()));
|
||||||
CreateDirectory(wsave_path.c_str(), 0);
|
CreateDirectory(wsave_path.c_str(), 0);
|
||||||
}
|
}
|
||||||
else if ((GetFileAttributes(wsave_path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
else if ((GetFileAttributes(wsave_path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||||
@@ -483,7 +504,15 @@ 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)
|
||||||
|
std::wstring wsave_path(safe_convert((save_path / single_file.branch_path()))
|
||||||
|
.native_directory_string());
|
||||||
|
CreateDirectory(wsave_path.c_str(), 0);
|
||||||
|
#else
|
||||||
create_directory(save_path / single_file.branch_path());
|
create_directory(save_path / single_file.branch_path());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
old_path = m_pimpl->save_path / single_file;
|
old_path = m_pimpl->save_path / single_file;
|
||||||
new_path = save_path / m_pimpl->info.begin_files()->path;
|
new_path = save_path / m_pimpl->info.begin_files()->path;
|
||||||
@@ -1305,11 +1334,8 @@ namespace libtorrent
|
|||||||
path dir = m_save_path / file_iter->path;
|
path dir = m_save_path / file_iter->path;
|
||||||
|
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
#if defined(WIN32) && defined(UNICODE)
|
||||||
std::wstring wdir(safe_convert(dir.branch_path().native_directory_string()));
|
if (!exists_win(dir.branch_path()))
|
||||||
if (GetFileAttributes(wdir.c_str()) != INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
create_directories_win(dir.branch_path());
|
create_directories_win(dir.branch_path());
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if (!exists(dir.branch_path()))
|
if (!exists(dir.branch_path()))
|
||||||
create_directories(dir.branch_path());
|
create_directories(dir.branch_path());
|
||||||
|
Reference in New Issue
Block a user