From 08555f0864ede3f2efd912689443a30aad1163ec Mon Sep 17 00:00:00 2001 From: lltcggie Date: Thu, 19 Nov 2015 02:46:23 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E3=81=A7=E3=83=95=E3=82=A9=E3=83=AB?= =?UTF-8?q?=E3=83=80=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E5=90=8D=E3=81=AE=E6=9C=AB=E5=B0=BE=E3=81=AE?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E8=A8=AD=E5=AE=9A=E6=A9=9F=E8=83=BD=E3=81=8C?= =?UTF-8?q?=E5=8B=95=E3=81=84=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe-gui/Source.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/waifu2x-caffe-gui/Source.cpp b/waifu2x-caffe-gui/Source.cpp index 44133bb..bca8558 100644 --- a/waifu2x-caffe-gui/Source.cpp +++ b/waifu2x-caffe-gui/Source.cpp @@ -493,7 +493,13 @@ private: SyncMember(true); const boost::filesystem::path output_path(output_str); - std::string stem = output_path.stem().string(); + std::string stem; + + if (!boost::filesystem::is_directory(input_str)) + stem = output_path.stem().string(); + else + stem = output_path.filename().string(); + if (stem.length() > 0 && stem.length() >= autoSetAddName.length()) { const std::string base = stem.substr(0, stem.length() - autoSetAddName.length()); @@ -503,7 +509,11 @@ private: const std::string addstr(AddName()); autoSetAddName = addstr; - boost::filesystem::path new_out_path = output_path.branch_path() / (base + addstr + outputExt); + boost::filesystem::path new_out_path; + if (!boost::filesystem::is_directory(input_str)) + new_out_path = output_path.branch_path() / (base + addstr + outputExt); + else + new_out_path = output_path.branch_path() / (base + addstr); SetWindowTextA(GetDlgItem(dh, IDC_EDIT_OUTPUT), new_out_path.string().c_str()); }