diff --git a/src/file_win.cpp b/src/file_win.cpp index 72211ebaf..90f2047d2 100644 --- a/src/file_win.cpp +++ b/src/file_win.cpp @@ -166,7 +166,7 @@ namespace libtorrent #ifdef UNICODE std::wstring wfile_name(safe_convert(file_name)); HANDLE new_handle = CreateFile( - (LPCWSTR)wfile_name.c_str() + wfile_name.c_str() , access_mask , FILE_SHARE_READ , 0 diff --git a/src/storage.cpp b/src/storage.cpp index 754b44c72..487e28281 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -1327,7 +1327,28 @@ namespace libtorrent // DO THE FULL CHECK // ------------------------ + + // first, create all missing directories + path last_path; + 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).branch_path(); + if (dir == last_path) continue; + last_path = dir; + +#if defined(WIN32) && defined(UNICODE) + if (!exists_win(last_path)) + create_directories_win(last_path); +#else + if (!exists(last_path)) + create_directories(last_path); +#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) { @@ -1341,7 +1362,7 @@ namespace libtorrent create_directories(dir.branch_path()); #endif } - +*/ std::vector piece_data(static_cast(m_info.piece_length())); // this maps a piece hash to piece index. It will be