3
Copyright (C) 1999 Stefan Westerfeld
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
#include <kmessagebox.h>
28
#include "portablekde.h"
29
#include "dirmanager.h"
33
const char *DirManager::mapDir()
37
if(!d) d = directory("/maps",i18n("instrument map files"));
41
const char *DirManager::sessionDir()
45
if(!d) d = directory("/sessions",
46
i18n("sessions (save files of the positions of all sliders/buttons)"));
51
const char *DirManager::structureDir()
55
if(!d) d = directory("/structures",i18n("structures (signal flow graphs)"));
59
const char *DirManager::baseDir()
63
if(!d) d = directory("",i18n("all aRts files/directories"));
67
char *DirManager::directory(const char *subdir, const char *desc)
69
const char *home = getenv("HOME");
71
if(home == 0) return strdup("");
72
string dirname = string(home) + string("/arts") + string(subdir);
75
if(stat(dirname.c_str(), &buf) == -1)
78
message = i18n("You need the directory %1.\n"
79
"It will be used to store %2.\nShould I create it now?")
80
.arg(dirname.c_str()).arg(desc);
82
if(KMessageBox::questionYesNo(0,message,i18n("aRts directory missing"))
86
sprintf(command,"mkdir -p %s",dirname.c_str());
91
return strdup(dirname.c_str());