From 8ff5d624df0c3977db6c5643a7be46fa052438e9 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 19 Mar 2012 16:15:26 +0100 Subject: [PATCH] create .config/autostart if necessary --- src/qtgui/rtitool.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qtgui/rtitool.cpp b/src/qtgui/rtitool.cpp index 426b0ebf..d1f91f91 100644 --- a/src/qtgui/rtitool.cpp +++ b/src/qtgui/rtitool.cpp @@ -104,6 +104,13 @@ void RTIToolW::accept() if (text.empty()) text = desktopfiletext; + // Try to create .config and autostart anyway. If they exists this will + // do nothing. An error will be detected when we try to create the file + string dir = path_cat(path_home(), ".config"); + mkdir(dir.c_str(), 0700); + dir = path_cat(dir, "autostart"); + mkdir(dir.c_str(), 0700); + int fd = ::open(autostartfile.c_str(), O_WRONLY|O_CREAT, 0644); if (fd < 0 || ::write(fd, text.c_str(), size_t(text.size())) != ssize_t(text.size()) || ::close(fd) != 0) {