mirror of
https://github.com/BernardoGiordano/Checkpoint
synced 2024-12-01 04:49:10 +00:00
fix #129
This commit is contained in:
parent
309cb99ce6
commit
640e3da76c
4 changed files with 24 additions and 6 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <locale>
|
||||
#include <string>
|
||||
#include <switch.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "clickable.hpp"
|
||||
#include "draw.hpp"
|
||||
|
@ -90,7 +91,7 @@ public:
|
|||
KeyboardManager(KeyboardManager const&) = delete;
|
||||
void operator=(KeyboardManager const&) = delete;
|
||||
|
||||
std::string keyboard(const std::string& suggestion);
|
||||
std::pair<bool, std::string> keyboard(const std::string& suggestion);
|
||||
|
||||
static const size_t CUSTOM_PATH_LEN = 49;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <switch.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <utility>
|
||||
#include "directory.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "KeyboardManager.hpp"
|
||||
|
|
|
@ -282,7 +282,7 @@ bool KeyboardManager::logic(std::string& str, size_t i)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string KeyboardManager::keyboard(const std::string& suggestion)
|
||||
std::pair<bool, std::string> KeyboardManager::keyboard(const std::string& suggestion)
|
||||
{
|
||||
size_t index;
|
||||
std::string str;
|
||||
|
@ -308,7 +308,7 @@ std::string KeyboardManager::keyboard(const std::string& suggestion)
|
|||
bool ret = logic(str, index);
|
||||
if (ret)
|
||||
{
|
||||
return str.empty() ? suggestion : str;
|
||||
return str.empty() ? std::make_pair(true, suggestion) : std::make_pair(true, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ std::string KeyboardManager::keyboard(const std::string& suggestion)
|
|||
bool ret = logic(str, i);
|
||||
if (ret)
|
||||
{
|
||||
return str.empty() ? suggestion : str;
|
||||
return str.empty() ? std::make_pair(true, suggestion) : std::make_pair(true, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,5 +361,5 @@ std::string KeyboardManager::keyboard(const std::string& suggestion)
|
|||
gfxWaitForVsync();
|
||||
}
|
||||
|
||||
return suggestion;
|
||||
return std::make_pair(false, suggestion);
|
||||
}
|
|
@ -232,7 +232,23 @@ void io::backup(size_t index, u128 uid)
|
|||
}
|
||||
else
|
||||
{
|
||||
customPath = isNewFolder ? StringUtils::removeForbiddenCharacters(KeyboardManager::get().keyboard(suggestion)) : "";
|
||||
if (isNewFolder)
|
||||
{
|
||||
std::pair<bool, std::string> keyboardResponse = KeyboardManager::get().keyboard(suggestion);
|
||||
if (keyboardResponse.first)
|
||||
{
|
||||
customPath = StringUtils::removeForbiddenCharacters(keyboardResponse.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileSystem::unmount();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
customPath = "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string dstPath;
|
||||
|
|
Loading…
Reference in a new issue