mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +00:00
Fix regression w/initial folder on file selector (fix #3979)
Regression introduced in 556c621eeb963498915cb01ca912327e629d81b5
This commit is contained in:
parent
400456cbec
commit
056073b3f1
@ -125,11 +125,9 @@ std::string get_initial_path_to_select_filename(const std::string& initialFilena
|
|||||||
std::string get_current_dir_for_file_selector()
|
std::string get_current_dir_for_file_selector()
|
||||||
{
|
{
|
||||||
std::string path = Preferences::instance().fileSelector.currentFolder();
|
std::string path = Preferences::instance().fileSelector.currentFolder();
|
||||||
// If it's empty or the folder doesn't exist anymore, starts from
|
// "<empty>" is the default value for this property, to start from
|
||||||
// the docs folder by default.
|
// the user docs folder by default.
|
||||||
if (path.empty() ||
|
if (path == "<empty>") {
|
||||||
path == "<empty>" ||
|
|
||||||
!base::is_directory(path)) {
|
|
||||||
path = base::get_user_docs_folder();
|
path = base::get_user_docs_folder();
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
|
@ -411,10 +411,20 @@ bool FileSelector::show(
|
|||||||
fs->refresh();
|
fs->refresh();
|
||||||
|
|
||||||
// We have to find where the user should begin to browse files
|
// We have to find where the user should begin to browse files
|
||||||
std::string start_folder_path =
|
std::string start_folder_path;
|
||||||
base::get_file_path(get_initial_path_to_select_filename(initialPath));
|
if (initialPath.empty()) {
|
||||||
IFileItem* start_folder = fs->getFileItemFromPath(start_folder_path);
|
start_folder_path = get_initial_path_to_select_filename(initialPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
start_folder_path = base::get_file_path(initialPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileItem* start_folder = fs->getFileItemFromPath(start_folder_path);
|
||||||
|
if (!start_folder) {
|
||||||
|
// If the directory doesn't exist anymore, get the default FS item
|
||||||
|
// (root item, or user folder).
|
||||||
|
start_folder = fs->getFileItemFromPath(std::string());
|
||||||
|
}
|
||||||
FILESEL_TRACE("FILESEL: Start folder '%s' (%p)\n", start_folder_path.c_str(), start_folder);
|
FILESEL_TRACE("FILESEL: Start folder '%s' (%p)\n", start_folder_path.c_str(), start_folder);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user