X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Futil.cpp;h=5aa21efe19083d5bd166053946b314acc9dad2c7;hp=25ff475b00ded9d329ac919440098e8c3d047c40;hb=be7d5dde2d1285e03a68f3f611f3b0ace1a619b4;hpb=e008cd12ef319c4b5f9fe5a8cc1524829551771d diff --git a/src/common/util.cpp b/src/common/util.cpp index 25ff475b..5aa21efe 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -138,3 +138,21 @@ QByteArray methodName(const QMetaMethod &method) { QByteArray sig(method.signature()); return sig.left(sig.indexOf("(")); } + +QDir quasselDir() { + // kinda ugly, but I currently see no other way to do that +#ifdef Q_OS_WIN32 + QString quasselDir = QDir::homePath() + qgetenv("APPDATA") + "/quassel/"; +#else + QString quasselDir = QDir::homePath() + "/.quassel/"; +#endif + + QDir qDir(quasselDir); + if(!qDir.exists(quasselDir)) { + if(!qDir.mkpath(quasselDir)) { + qCritical() << "Unable to create Quassel data directory:" << qPrintable(qDir.absolutePath()); + } + } + + return qDir; +}