editor: remove trailing whitespace from padded app name (#1130)
This commit is contained in:
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
|
||||
height = std::max(100, height);
|
||||
|
||||
sdl2::window_ptr_t window = sdl2::make_window(
|
||||
exe_customization.name_256padded,
|
||||
wi::helper::StringRemoveTrailingWhitespaces(exe_customization.name_256padded).c_str(),
|
||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
width, height,
|
||||
SDL_WINDOW_SHOWN | SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
|
||||
@@ -140,7 +140,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wcex.lpszMenuName = NULL;
|
||||
wchar_t wname[256] = {};
|
||||
wi::helper::StringConvert(exe_customization.name_256padded, wname, arraysize(wname));
|
||||
wi::helper::StringConvert(wi::helper::StringRemoveTrailingWhitespaces(exe_customization.name_256padded).c_str(), wname, arraysize(wname));
|
||||
wcex.lpszClassName = wname;
|
||||
RegisterClassExW(&wcex);
|
||||
|
||||
|
||||
@@ -1753,7 +1753,16 @@ namespace wi::helper
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
|
||||
std::string StringRemoveTrailingWhitespaces(const std::string& str)
|
||||
{
|
||||
size_t found;
|
||||
found = str.find_last_not_of(" /t");
|
||||
if (found == std::string::npos)
|
||||
return str;
|
||||
return str.substr(0, found + 1);
|
||||
}
|
||||
|
||||
void DebugOut(const std::string& str, DebugLevel level)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -162,6 +162,8 @@ namespace wi::helper
|
||||
// returns result string length
|
||||
int StringConvert(const wchar_t* from, char* to, int dest_size_in_characters);
|
||||
|
||||
std::string StringRemoveTrailingWhitespaces(const std::string& str);
|
||||
|
||||
// Prints debug info to the console output
|
||||
enum class DebugLevel
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user