From 0b167104ee34832c8e0a7bc95421289f92a961a2 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Sun, 20 Mar 2016 13:38:14 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E3=81=A7=E5=8D=98=E4=BD=93=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E5=85=A5=E5=8A=9B=E3=81=97?= =?UTF-8?q?=E3=81=9F=E6=99=82=E3=81=AB=E5=A4=89=E6=8F=9B=E3=81=AB=E5=A4=B1?= =?UTF-8?q?=E6=95=97=E3=81=99=E3=82=8B=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe-gui/Source.cpp | 43 ++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/waifu2x-caffe-gui/Source.cpp b/waifu2x-caffe-gui/Source.cpp index 00deb9c..97854b4 100644 --- a/waifu2x-caffe-gui/Source.cpp +++ b/waifu2x-caffe-gui/Source.cpp @@ -611,7 +611,23 @@ private: } } else + { + const boost::filesystem::path output_path(output_str); + const auto outDir = output_path.branch_path(); + + if (!boost::filesystem::exists(outDir)) + { + if (!boost::filesystem::create_directories(outDir)) + { + SendMessage(dh, WM_FAILD_CREATE_DIR, (WPARAM)&outDir, 0); + PostMessage(dh, WM_END_THREAD, 0, 0); + // printf("出力フォルダ「%s」の作成に失敗しました\n", output_path.string().c_str()); + return; + } + } + file_paths.emplace_back(input_str, output_str); + } }; const auto inputFuncMulti = [this, &file_paths](const tstring &input) @@ -692,25 +708,24 @@ private: } else { + const auto &outDir = output_path; + + if (!boost::filesystem::exists(outDir)) + { + if (!boost::filesystem::create_directories(outDir)) + { + SendMessage(dh, WM_FAILD_CREATE_DIR, (WPARAM)&outDir, 0); + PostMessage(dh, WM_END_THREAD, 0, 0); + // printf("出力フォルダ「%s」の作成に失敗しました\n", output_path.string().c_str()); + return; + } + } + const auto out = output_path / (input_path.stem().wstring() + outputExt); file_paths.emplace_back(input_path.wstring(), out.wstring()); } }; - { - const boost::filesystem::path output_path(boost::filesystem::absolute(output_str)); - if (!boost::filesystem::exists(output_path)) - { - if (!boost::filesystem::create_directory(output_path)) - { - SendMessage(dh, WM_FAILD_CREATE_DIR, (WPARAM)&output_path, 0); - PostMessage(dh, WM_END_THREAD, 0, 0); - // printf("出力フォルダ「%s」の作成に失敗しました\n", output_path.string().c_str()); - return; - } - } - } - if(input_str_multi.size() == 0) inputFunc(input_str); else