Don't rely on Boost not trying to create a directory if a drive is mounted on one

Fix for bug 701.
This commit is contained in:
Moritz Bunkus 2012-01-12 22:30:34 +01:00
parent 0ad859814b
commit 46e684d7f6
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2012-01-12 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Fixed writing into paths on which a drive is
mounted on Windows. Fix for bug 701.
2012-01-09 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: enhancement: Added a field

View File

@ -149,8 +149,12 @@ mm_file_io_c::setup() {
void
mm_file_io_c::prepare_path(const std::string &path) {
boost::filesystem::path directory = boost::filesystem::path(path).parent_path();
if (boost::filesystem::exists(directory))
return;
boost::system::error_code error_code;
boost::filesystem::create_directories(boost::filesystem::path(path).parent_path(), error_code);
boost::filesystem::create_directories(directory, error_code);
if (error_code)
throw mtx::mm_io::create_directory_x(path, strerror(error_code.value()), error_code.value());
}