X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Futil.cpp;h=76a3e0c4034fcd15cc71313fe272954e5de0d20a;hp=25ff475b00ded9d329ac919440098e8c3d047c40;hb=d2f47b8db0c70f434b486583d09062ea77747e66;hpb=e008cd12ef319c4b5f9fe5a8cc1524829551771d diff --git a/src/common/util.cpp b/src/common/util.cpp index 25ff475b..76a3e0c4 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 = 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; +}