Added persistant config for file source

This commit is contained in:
Ryzerth
2021-04-29 22:04:20 +02:00
parent bed0712be1
commit ce8b4ceb44
5 changed files with 22 additions and 6 deletions

View File

@ -45,10 +45,11 @@ bool FileSelect::render(std::string id) {
return _pathChanged;
}
void FileSelect::setPath(std::string path) {
void FileSelect::setPath(std::string path, bool markChanged) {
this->path = path;
std::string expandedPath = expandString(path);
pathValid = std::filesystem::is_regular_file(expandedPath);
if (markChanged) { pathChanged = true; }
strcpy(strPath, path.c_str());
}

View File

@ -10,7 +10,7 @@ class FileSelect {
public:
FileSelect(std::string defaultPath, std::vector<std::string> filter = {"All Files", "*"});
bool render(std::string id);
void setPath(std::string path);
void setPath(std::string path, bool markChanged = false);
bool pathIsValid();
std::string expandString(std::string input);

View File

@ -44,10 +44,11 @@ bool FolderSelect::render(std::string id) {
return _pathChanged;
}
void FolderSelect::setPath(std::string path) {
void FolderSelect::setPath(std::string path, bool markChanged) {
this->path = path;
std::string expandedPath = expandString(path);
pathValid = std::filesystem::is_directory(expandedPath);
if (markChanged) { pathChanged = true; }
strcpy(strPath, path.c_str());
}

View File

@ -9,7 +9,7 @@ class FolderSelect {
public:
FolderSelect(std::string defaultPath);
bool render(std::string id);
void setPath(std::string path);
void setPath(std::string path, bool markChanged = false);
bool pathIsValid();
std::string expandString(std::string input);