From 4c51b9e8f2033689ee644c29224f474c364f3bc0 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Sun, 6 Dec 2015 21:31:51 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E3=81=A7=E8=87=AA=E5=8B=95=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=97=E3=81=9F=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E3=81=AE=E5=BE=8C=E3=81=AB=E6=96=87=E5=AD=97=E3=81=8C?= =?UTF-8?q?=E5=85=A5=E3=81=A3=E3=81=A6=E3=81=84=E3=81=A6=E3=82=82=E3=81=A1?= =?UTF-8?q?=E3=82=83=E3=82=93=E3=81=A8=E7=BD=AE=E3=81=8D=E6=8F=9B=E3=82=8F?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe-gui/Source.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/waifu2x-caffe-gui/Source.cpp b/waifu2x-caffe-gui/Source.cpp index 7dc2923..6426cc1 100644 --- a/waifu2x-caffe-gui/Source.cpp +++ b/waifu2x-caffe-gui/Source.cpp @@ -567,7 +567,7 @@ private: PostMessage(dh, WM_END_THREAD, 0, 0); } - void ReplaceAddString() + void ReplaceAddString() // ファイル名の自動設定部分を書き換える { SyncMember(true); @@ -581,18 +581,21 @@ private: if (stem.length() > 0 && stem.length() >= autoSetAddName.length()) { - const tstring base = stem.substr(0, stem.length() - autoSetAddName.length()); - stem.erase(0, base.length()); - if (stem == autoSetAddName) + const auto pos = stem.find(autoSetAddName); + if (pos != tstring::npos) { const tstring addstr(AddName()); + + auto new_name = stem; + new_name.replace(pos, autoSetAddName.length(), addstr); + autoSetAddName = addstr; boost::filesystem::path new_out_path; if (!boost::filesystem::is_directory(input_str)) - new_out_path = output_path.branch_path() / (base + addstr + outputExt); + new_out_path = output_path.branch_path() / (new_name + outputExt); else - new_out_path = output_path.branch_path() / (base + addstr); + new_out_path = output_path.branch_path() / (new_name); SetWindowText(GetDlgItem(dh, IDC_EDIT_OUTPUT), getTString(new_out_path).c_str()); }