error when failed to create config file
This commit is contained in:
parent
d1887db2a5
commit
535dac480a
@ -33,6 +33,7 @@ extern const char* SELECT_PROCESS_INFO;
|
||||
extern const char* FROM_COMPUTER;
|
||||
extern const char* PROCESSES;
|
||||
extern const char* CODE_INFODUMP;
|
||||
extern const char* FAILED_TO_CREATE_CONFIG_FILE;
|
||||
extern const char* HOOK_SEARCH_UNSTABLE_WARNING;
|
||||
extern const char* SEARCH_CJK;
|
||||
extern const char* SEARCH_PATTERN;
|
||||
@ -198,7 +199,8 @@ namespace
|
||||
{
|
||||
std::wstring configFile = std::wstring(processName.value()).replace(last, std::wstring::npos, GAME_CONFIG_FILE);
|
||||
if (!std::filesystem::exists(configFile)) QTextFile(S(configFile), QFile::WriteOnly).write("see https://github.com/Artikash/Textractor/wiki/Game-configuration-file");
|
||||
_wspawnlp(_P_DETACH, L"notepad", L"notepad", configFile.c_str(), NULL);
|
||||
if (std::filesystem::exists(configFile)) _wspawnlp(_P_DETACH, L"notepad", L"notepad", configFile.c_str(), NULL);
|
||||
else QMessageBox::critical(This, GAME_CONFIG, QString(FAILED_TO_CREATE_CONFIG_FILE).arg(S(configFile)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,4 +31,4 @@ inline QString S(const std::string& s) { return QString::fromStdString(s); }
|
||||
inline QString S(const std::wstring& s) { return QString::fromStdWString(s); }
|
||||
// TODO: allow paired surrogates
|
||||
inline void sanitize(QString& s) { s.chop(std::distance(std::remove_if(s.begin(), s.end(), [](QChar ch) { return ch.isSurrogate(); }), s.end())); }
|
||||
inline QString sanitize(QString&& s) { QString result; for (auto ch : s) if (!ch.isSurrogate()) result.push_back(ch); return result; }
|
||||
inline QString sanitize(QString&& s) { sanitize(s); return s; }
|
||||
|
1
text.cpp
1
text.cpp
@ -64,6 +64,7 @@ const char* INVALID_EXTENSION = u8"%1 is an invalid extension";
|
||||
const char* CONFIRM_EXTENSION_OVERWRITE = u8"Another version of this extension already exists, do you want to delete and overwrite it?";
|
||||
const char* EXTENSION_WRITE_ERROR = u8"Failed to save extension";
|
||||
const char* USE_JP_LOCALE = u8"Emulate japanese locale?";
|
||||
const char* FAILED_TO_CREATE_CONFIG_FILE = u8"Failed to create config file \"%1\"";
|
||||
const char* HOOK_SEARCH_UNSTABLE_WARNING = u8"Searching for hooks is unstable! Be prepared for your game to crash!";
|
||||
const char* SEARCH_CJK = u8"Search for Chinese/Japanese/Korean";
|
||||
const char* SEARCH_PATTERN = u8"Search pattern (hex byte array)";
|
||||
|
Loading…
Reference in New Issue
Block a user