diff --git a/sakura_core/String_define.h b/sakura_core/String_define.h index 2b6f37807e..41db36f1d8 100644 --- a/sakura_core/String_define.h +++ b/sakura_core/String_define.h @@ -1385,5 +1385,6 @@ #define STR_KEYHELP_RMENU_NONE 35029 #define STR_KEYHELP_RMENU_TOP 35030 #define STR_KEYHELP_RMENU_BOTTOM 35031 +#define STR_ERR_FILEPATH_TOO_LONG 35034 -// Now using max number 35033 by STR_LOADAGENT_BIG_ERROR +// Now using max number 35034 by STR_ERR_FILEPATH_TOO_LONG diff --git a/sakura_core/cmd/CViewCommander_File.cpp b/sakura_core/cmd/CViewCommander_File.cpp index b983bdee21..afe0afa6a5 100644 --- a/sakura_core/cmd/CViewCommander_File.cpp +++ b/sakura_core/cmd/CViewCommander_File.cpp @@ -136,6 +136,16 @@ void CViewCommander::Command_FILEOPEN( const WCHAR* filename, ECodeType nCharCod ); if(!bDlgResult)return; + for(size_t i = 0; i < files.size(); i++ ){ + if (files[i].length() >= _MAX_PATH){ + ErrorMessage( + CEditWnd::getInstance()->GetHwnd(), + LS(STR_ERR_FILEPATH_TOO_LONG), + files[i].c_str() + ); + return; + } + } sLoadInfo.cFilePath = files[0].c_str(); // 他のファイルは新規ウィンドウ int nSize = (int)files.size(); diff --git a/sakura_core/sakura_rc.rc b/sakura_core/sakura_rc.rc index 54199d9b18..96070a9670 100644 --- a/sakura_core/sakura_rc.rc +++ b/sakura_core/sakura_rc.rc @@ -4121,6 +4121,8 @@ GDI リソース\t残り %d%%\n\n" STR_FILETREE_REPLACE_PATH_FROM "置換元パスを指定してください" STR_FILETREE_REPLACE_PATH_TO "置換先文字列を指定してください" + STR_ERR_FILEPATH_TOO_LONG "%ls\nというファイルを開けません。\nファイルのパスが長すぎます。" + END STRINGTABLE DISCARDABLE diff --git a/sakura_lang_en_US/sakura_lang_rc.rc b/sakura_lang_en_US/sakura_lang_rc.rc index 19bfe58704..5ab2657a19 100644 --- a/sakura_lang_en_US/sakura_lang_rc.rc +++ b/sakura_lang_en_US/sakura_lang_rc.rc @@ -4132,6 +4132,9 @@ GDI Resource\tRemaining %d%%\n\n" STR_FILETREE_REPLACE_PATH_FROM "Please Input Replace 'From' Path" STR_FILETREE_REPLACE_PATH_TO "Please Input Replace 'To' Path" + STR_ERR_FILEPATH_TOO_LONG "'%ts'\nCannot open the file.\nThe filepath is too long." + + END STRINGTABLE DISCARDABLE