mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix issue where too long filenames could wreck the Install Zip dialog layout.
Well, technically just shortens the path to avoid the issue.
This commit is contained in:
parent
ccfcbc7462
commit
259cb0f128
3 changed files with 22 additions and 2 deletions
|
@ -95,4 +95,20 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
|
|||
*_pExtension = full_path.substr(fname_end);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetFilenameFromPath(std::string full_path) {
|
||||
size_t pos;
|
||||
#ifdef _WIN32
|
||||
pos = full_path.rfind('\\');
|
||||
if (pos != std::string::npos) {
|
||||
return full_path.substr(pos + 1);
|
||||
}
|
||||
#endif
|
||||
pos = full_path.rfind('/');
|
||||
if (pos != std::string::npos) {
|
||||
return full_path.substr(pos + 1);
|
||||
}
|
||||
// No directory components, just return the full path.
|
||||
return full_path;
|
||||
}
|
||||
|
|
|
@ -45,3 +45,5 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
|
|||
|
||||
// "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe"
|
||||
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
|
||||
|
||||
std::string GetFilenameFromPath(std::string full_path);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "UI/ui_atlas.h"
|
||||
#include "file/file_util.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Util/GameManager.h"
|
||||
#include "UI/InstallZipScreen.h"
|
||||
#include "UI/MainScreen.h"
|
||||
|
@ -43,8 +44,9 @@ void InstallZipScreen::CreateViews() {
|
|||
ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f));
|
||||
root_->Add(leftColumn);
|
||||
|
||||
std::string shortFilename = GetFilenameFromPath(zipPath_);
|
||||
leftColumn->Add(new TextView(iz->T("Install game from ZIP file?"), ALIGN_LEFT, false, new AnchorLayoutParams(10, 10, NONE, NONE)));
|
||||
leftColumn->Add(new TextView(zipPath_, ALIGN_LEFT, false, new AnchorLayoutParams(10, 60, NONE, NONE)));
|
||||
leftColumn->Add(new TextView(shortFilename, ALIGN_LEFT, false, new AnchorLayoutParams(10, 60, NONE, NONE)));
|
||||
|
||||
doneView_ = leftColumn->Add(new TextView("", new AnchorLayoutParams(10, 120, NONE, NONE)));
|
||||
progressBar_ = leftColumn->Add(new ProgressBar(new AnchorLayoutParams(10, 200, 200, NONE)));
|
||||
|
|
Loading…
Add table
Reference in a new issue