-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index 7f2a326..1c3e0ae 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp | |||
@@ -29,32 +29,33 @@ | |||
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | #include <assert.h> | 30 | #include <assert.h> |
31 | //US#include <errno.h> | 31 | //US#include <errno.h> |
32 | //US #ifdef HAVE_SYS_STAT_H | 32 | //US #ifdef HAVE_SYS_STAT_H |
33 | //US #include <sys/stat.h> | 33 | //US #include <sys/stat.h> |
34 | //US #endif | 34 | //US #endif |
35 | //US#include <sys/types.h> | 35 | //US#include <sys/types.h> |
36 | //US#include <dirent.h> | 36 | //US#include <dirent.h> |
37 | //US#include <pwd.h> | 37 | //US#include <pwd.h> |
38 | 38 | ||
39 | #include <qregexp.h> | 39 | #include <qregexp.h> |
40 | #include <qasciidict.h> | 40 | #include <qasciidict.h> |
41 | #include <qdict.h> | 41 | #include <qdict.h> |
42 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qfileinfo.h> | 43 | #include <qfileinfo.h> |
44 | #include <qstring.h> | 44 | #include <qstring.h> |
45 | #include <qmessagebox.h> | ||
45 | #include <qapplication.h> | 46 | #include <qapplication.h> |
46 | 47 | ||
47 | #include <qstringlist.h> | 48 | #include <qstringlist.h> |
48 | 49 | ||
49 | #include "kstandarddirs.h" | 50 | #include "kstandarddirs.h" |
50 | #include "kconfig.h" | 51 | #include "kconfig.h" |
51 | #include "kdebug.h" | 52 | #include "kdebug.h" |
52 | //US #include "kinstance.h" | 53 | //US #include "kinstance.h" |
53 | #include "kshell.h" | 54 | #include "kshell.h" |
54 | //US#include <sys/param.h> | 55 | //US#include <sys/param.h> |
55 | //US#include <unistd.h> | 56 | //US#include <unistd.h> |
56 | 57 | ||
57 | //US | 58 | //US |
58 | QString KStandardDirs::mAppDir = QString::null; | 59 | QString KStandardDirs::mAppDir = QString::null; |
59 | 60 | ||
60 | 61 | ||
@@ -1191,44 +1192,48 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) | |||
1191 | //qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1()); | 1192 | //qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1()); |
1192 | if (dirObj.mkdir(base) != true) | 1193 | if (dirObj.mkdir(base) != true) |
1193 | { | 1194 | { |
1194 | qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1()); | 1195 | qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1()); |
1195 | return false; | 1196 | return false; |
1196 | } | 1197 | } |
1197 | } | 1198 | } |
1198 | 1199 | ||
1199 | i = pos + 1; | 1200 | i = pos + 1; |
1200 | } | 1201 | } |
1201 | return true; | 1202 | return true; |
1202 | 1203 | ||
1203 | } | 1204 | } |
1204 | 1205 | ||
1205 | static QString readEnvPath(const char *env) | 1206 | static QString readEnvPath(const char *env) |
1206 | { | 1207 | { |
1207 | #ifdef _WIN32_ | 1208 | //#ifdef _WIN32_ |
1208 | return ""; | 1209 | // return ""; |
1209 | #else | 1210 | //#else |
1210 | QCString c_path = getenv(env); | 1211 | QCString c_path; |
1211 | if (c_path.isEmpty()) | 1212 | if ( getenv(env) != NULL ) |
1212 | return QString::null; | 1213 | c_path = QString ( getenv(env) ); |
1213 | return QFile::decodeName(c_path); | 1214 | if (c_path.isEmpty()) |
1214 | #endif | 1215 | return QString::null; |
1216 | return QFile::decodeName(c_path); | ||
1217 | //#endif | ||
1218 | |||
1215 | } | 1219 | } |
1216 | 1220 | ||
1217 | void KStandardDirs::addKDEDefaults() | 1221 | void KStandardDirs::addKDEDefaults() |
1218 | { | 1222 | { |
1223 | |||
1219 | //qDebug("ERROR: KStandardDirs::addKDEDefaults() called "); | 1224 | //qDebug("ERROR: KStandardDirs::addKDEDefaults() called "); |
1220 | //return; | 1225 | //return; |
1221 | QStringList kdedirList; | 1226 | QStringList kdedirList; |
1222 | 1227 | ||
1223 | // begin KDEDIRS | 1228 | // begin KDEDIRS |
1224 | QString kdedirs = readEnvPath("MICROKDEDIRS"); | 1229 | QString kdedirs = readEnvPath("MICROKDEDIRS"); |
1225 | if (!kdedirs.isEmpty()) | 1230 | if (!kdedirs.isEmpty()) |
1226 | { | 1231 | { |
1227 | tokenize(kdedirList, kdedirs, ":"); | 1232 | tokenize(kdedirList, kdedirs, ":"); |
1228 | } | 1233 | } |
1229 | else | 1234 | else |
1230 | { | 1235 | { |
1231 | QString kdedir = readEnvPath("MICROKDEDIR"); | 1236 | QString kdedir = readEnvPath("MICROKDEDIR"); |
1232 | if (!kdedir.isEmpty()) | 1237 | if (!kdedir.isEmpty()) |
1233 | { | 1238 | { |
1234 | kdedir = KShell::tildeExpand(kdedir); | 1239 | kdedir = KShell::tildeExpand(kdedir); |
@@ -1254,34 +1259,40 @@ void KStandardDirs::addKDEDefaults() | |||
1254 | #endif | 1259 | #endif |
1255 | 1260 | ||
1256 | #ifdef __KDE_EXECPREFIX | 1261 | #ifdef __KDE_EXECPREFIX |
1257 | QString execPrefix(__KDE_EXECPREFIX); | 1262 | QString execPrefix(__KDE_EXECPREFIX); |
1258 | if (execPrefix!="NONE") | 1263 | if (execPrefix!="NONE") |
1259 | kdedirList.append(execPrefix); | 1264 | kdedirList.append(execPrefix); |
1260 | #endif | 1265 | #endif |
1261 | 1266 | ||
1262 | QString localKdeDir; | 1267 | QString localKdeDir; |
1263 | 1268 | ||
1264 | //US if (getuid()) | 1269 | //US if (getuid()) |
1265 | if (true) | 1270 | if (true) |
1266 | { | 1271 | { |
1267 | localKdeDir = readEnvPath("MICROKDEHOME"); | 1272 | localKdeDir = readEnvPath("MICROKDEHOME"); |
1268 | if (!localKdeDir.isEmpty()) | 1273 | if (!localKdeDir.isEmpty()) |
1269 | { | 1274 | { |
1275 | #ifdef _WIN32_ | ||
1276 | if (localKdeDir.at(localKdeDir.length()-1) != '\\') | ||
1277 | localKdeDir += '\\'; | ||
1278 | #else | ||
1270 | if (localKdeDir.at(localKdeDir.length()-1) != '/') | 1279 | if (localKdeDir.at(localKdeDir.length()-1) != '/') |
1271 | localKdeDir += '/'; | 1280 | localKdeDir += '/'; |
1281 | #endif | ||
1282 | //QMessageBox::information( 0,"localKdeDir",localKdeDir, 1 ); | ||
1272 | } | 1283 | } |
1273 | else | 1284 | else |
1274 | { | 1285 | { |
1275 | localKdeDir = QDir::homeDirPath() + "/kdepim/"; | 1286 | localKdeDir = QDir::homeDirPath() + "/kdepim/"; |
1276 | } | 1287 | } |
1277 | } | 1288 | } |
1278 | else | 1289 | else |
1279 | { | 1290 | { |
1280 | // We treat root different to prevent root messing up the | 1291 | // We treat root different to prevent root messing up the |
1281 | // file permissions in the users home directory. | 1292 | // file permissions in the users home directory. |
1282 | localKdeDir = readEnvPath("MICROKDEROOTHOME"); | 1293 | localKdeDir = readEnvPath("MICROKDEROOTHOME"); |
1283 | if (!localKdeDir.isEmpty()) | 1294 | if (!localKdeDir.isEmpty()) |
1284 | { | 1295 | { |
1285 | if (localKdeDir.at(localKdeDir.length()-1) != '/') | 1296 | if (localKdeDir.at(localKdeDir.length()-1) != '/') |
1286 | localKdeDir += '/'; | 1297 | localKdeDir += '/'; |
1287 | } | 1298 | } |