From 46e684d7f62c6b0bae31627e7964717118c52428 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 12 Jan 2012 22:30:34 +0100 Subject: [PATCH] Don't rely on Boost not trying to create a directory if a drive is mounted on one Fix for bug 701. --- ChangeLog | 5 +++++ src/common/mm_io.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f0e49477a..974e43d7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-01-12 Moritz Bunkus + + * mkvmerge: bug fix: Fixed writing into paths on which a drive is + mounted on Windows. Fix for bug 701. + 2012-01-09 Moritz Bunkus * mkvmerge: enhancement: Added a field diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index 6c153d921..8dd9d2511 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -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()); }