Skip to content

Commit

Permalink
Create libfm-qt dir if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujan committed Aug 15, 2024
1 parent bf9b634 commit df4b49e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core/bookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ void Bookmarks::save() {
}
idle_handler = false;
// G_UNLOCK(bookmarks);
GError* err = nullptr;
if(!g_file_replace_contents(file_.gfile().get(), buf.c_str(), buf.length(), nullptr,
FALSE, G_FILE_CREATE_NONE, nullptr, nullptr, &err)) {
g_critical("%s", err->message);
g_error_free(err);
CStrPtr libfmDataDir{g_build_filename(g_get_user_data_dir(), "libfm-qt", nullptr)};
if(g_mkdir_with_parents(libfmDataDir.get(), 0755) == 0) {
GError* err = nullptr;
if(!g_file_replace_contents(file_.gfile().get(), buf.c_str(), buf.length(), nullptr,
FALSE, G_FILE_CREATE_NONE, nullptr, nullptr, &err)) {
g_critical("%s", err->message);
g_error_free(err);
}
}
/* we changed bookmarks list, let inform who interested in that */
Q_EMIT changed();
Expand Down

0 comments on commit df4b49e

Please sign in to comment.