Skip to content

Commit df4b49e

Browse files
committed
Create libfm-qt dir if needed
1 parent bf9b634 commit df4b49e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/core/bookmarks.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,14 @@ void Bookmarks::save() {
164164
}
165165
idle_handler = false;
166166
// G_UNLOCK(bookmarks);
167-
GError* err = nullptr;
168-
if(!g_file_replace_contents(file_.gfile().get(), buf.c_str(), buf.length(), nullptr,
169-
FALSE, G_FILE_CREATE_NONE, nullptr, nullptr, &err)) {
170-
g_critical("%s", err->message);
171-
g_error_free(err);
167+
CStrPtr libfmDataDir{g_build_filename(g_get_user_data_dir(), "libfm-qt", nullptr)};
168+
if(g_mkdir_with_parents(libfmDataDir.get(), 0755) == 0) {
169+
GError* err = nullptr;
170+
if(!g_file_replace_contents(file_.gfile().get(), buf.c_str(), buf.length(), nullptr,
171+
FALSE, G_FILE_CREATE_NONE, nullptr, nullptr, &err)) {
172+
g_critical("%s", err->message);
173+
g_error_free(err);
174+
}
172175
}
173176
/* we changed bookmarks list, let inform who interested in that */
174177
Q_EMIT changed();

0 commit comments

Comments
 (0)