Don't save shapes directory to the "last_dir"

This commit is contained in:
YuSanka 2021-07-21 16:13:40 +02:00
parent c7051c9005
commit 232309a879
4 changed files with 11 additions and 3 deletions

View File

@ -544,6 +544,8 @@ void AppConfig::update_config_dir(const std::string &dir)
void AppConfig::update_skein_dir(const std::string &dir)
{
if (dir == sys_shapes_dir() || dir == custom_shapes_dir())
return; // do not save "shapes gallery" directory
this->set("recent", "skein_directory", dir);
}
/*

View File

@ -50,6 +50,9 @@ void set_sys_shapes_dir(const std::string &path);
// Return a full path to the system shapes gallery directory.
const std::string& sys_shapes_dir();
// Return a full path to the custom shapes gallery directory.
std::string custom_shapes_dir();
// Set a path with preset files.
void set_data_dir(const std::string &path);
// Return a full path to the GUI resource files.

View File

@ -202,6 +202,11 @@ const std::string& data_dir()
return g_data_dir;
}
std::string custom_shapes_dir()
{
return (boost::filesystem::path(g_data_dir) / "shapes").string();
}
#ifdef _WIN32
// The following helpers are borrowed from the LLVM project https://github.com/llvm
namespace WindowsSupport

View File

@ -219,9 +219,7 @@ static void add_default_image(wxImageList* img_list, bool is_system)
static fs::path get_dir(bool sys_dir)
{
if (sys_dir)
return fs::absolute(fs::path(sys_shapes_dir())).make_preferred();
return fs::absolute(fs::path(data_dir()) / "shapes").make_preferred();
return fs::absolute(fs::path(sys_dir ? sys_shapes_dir() : custom_shapes_dir())).make_preferred();
}
static std::string get_dir_path(bool sys_dir)