mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 13:42:48 +00:00
GUIで自動設定したファイル名の後に文字が入っていてもちゃんと置き換わるようにした
This commit is contained in:
parent
f75b4e448b
commit
4c51b9e8f2
@ -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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user