From 8336c831297137f02a8f876019e2f7f5b415241b Mon Sep 17 00:00:00 2001 From: Ayla Date: Sun, 3 Apr 2011 11:34:40 +0200 Subject: [PATCH] If the "sections/" directory is missing, we create it as well as some default sections (settings, applications...). --- src/menu.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/menu.cpp b/src/menu.cpp index 6678427..d754311 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -44,7 +44,16 @@ Menu::Menu(GMenu2X *gmenu2x) { struct dirent *dptr; string filepath; - if ((dirp = opendir("sections")) == NULL) return; + dirp = opendir((GMenu2X::getHome()+"/sections").c_str()); + if (dirp == NULL) { + mkdir((GMenu2X::getHome()+"/sections").c_str(), 0770); + mkdir((GMenu2X::getHome()+"/sections/settings").c_str(), 0770); + mkdir((GMenu2X::getHome()+"/sections/applications").c_str(), 0770); + mkdir((GMenu2X::getHome()+"/sections/emulators").c_str(), 0770); + mkdir((GMenu2X::getHome()+"/sections/games").c_str(), 0770); + + dirp = opendir((GMenu2X::getHome()+"/sections").c_str()); + } while ((dptr = readdir(dirp))) { if (dptr->d_name[0]=='.') continue;