🚧 cleanup

This commit is contained in:
Vladislav Nepogodin 2021-09-23 02:10:00 +04:00
parent 8f29d23e72
commit 994d70b226
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
1 changed files with 9 additions and 4 deletions

View File

@ -391,10 +391,15 @@ void Hello::set_locale(const std::string_view& use_locale) noexcept {
} }
void Hello::set_autostart(const bool& autostart) noexcept { void Hello::set_autostart(const bool& autostart) noexcept {
if (autostart && !fs::is_regular_file(fix_path(m_preferences["autostart_path"]))) { fs::path autostart_path{fix_path(m_preferences["autostart_path"])};
fs::create_symlink(m_preferences["desktop_path"], fix_path(m_preferences["autostart_path"])); const auto& config_dir = autostart_path.parent_path();
} else if (!autostart && fs::is_regular_file(fix_path(m_preferences["autostart_path"]))) { if (!fs::exists(config_dir)) {
fs::remove(fix_path(m_preferences["autostart_path"])); fs::create_directories(config_dir);
}
if (autostart && !fs::is_regular_file(autostart_path)) {
fs::create_symlink(m_preferences["desktop_path"], autostart_path);
} else if (!autostart && fs::is_regular_file(autostart_path)) {
fs::remove(autostart_path);
} }
m_autostart = autostart; m_autostart = autostart;
} }