KDECore
kstandarddirs_unix.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2007 Bernhard Loos <nhuh.put@web.de> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "kstandarddirs.h" 00020 00021 #include <config-prefix.h> 00022 #include <config.h> 00023 #include <QFile> 00024 00025 QString KStandardDirs::installPath(const char *type) 00026 { 00027 Q_ASSERT(type != NULL); 00028 00029 switch (type[0]) { 00030 case 'a': 00031 if (strcmp("apps", type) == 0) 00032 return QFile::decodeName(APPLNK_INSTALL_DIR "/"); 00033 break; 00034 case 'c': 00035 if (strcmp("config", type) == 0) 00036 return QFile::decodeName(CONFIG_INSTALL_DIR "/"); 00037 break; 00038 case 'k': 00039 if (strcmp("kcfg", type) == 0) 00040 return QFile::decodeName(KCFG_INSTALL_DIR "/"); 00041 if (strcmp("kdedir", type) == 0) 00042 return QFile::decodeName(KDEDIR "/"); 00043 break; 00044 case 'd': 00045 if (strcmp("data", type) == 0) 00046 return QFile::decodeName(DATA_INSTALL_DIR "/"); 00047 break; 00048 case 'e': 00049 if (strcmp("exe", type) == 0) 00050 return QFile::decodeName(BIN_INSTALL_DIR "/"); 00051 break; 00052 case 'h': 00053 if (strcmp("html", type) == 0) 00054 return QFile::decodeName(HTML_INSTALL_DIR "/"); 00055 break; 00056 case 'i': 00057 if (strcmp("icon", type) == 0) 00058 return QFile::decodeName(ICON_INSTALL_DIR "/"); 00059 if (strcmp("include", type) == 0) 00060 return QFile::decodeName(INCLUDE_INSTALL_DIR "/"); 00061 break; 00062 case 'l': 00063 if (strcmp("lib", type) == 0) 00064 return QFile::decodeName(LIB_INSTALL_DIR "/"); 00065 if (strcmp("libexec", type) == 0) 00066 return QFile::decodeName(LIBEXEC_INSTALL_DIR "/"); 00067 if (strcmp("locale", type) == 0) 00068 return QFile::decodeName(LOCALE_INSTALL_DIR "/"); 00069 break; 00070 case 'm': 00071 if (strcmp("module", type) == 0) 00072 return QFile::decodeName(PLUGIN_INSTALL_DIR "/"); 00073 if (strcmp("mime", type) == 0) 00074 return QFile::decodeName(MIME_INSTALL_DIR "/"); 00075 break; 00076 case 'q': 00077 if (strcmp("qtplugins", type) == 0) 00078 return QFile::decodeName(PLUGIN_INSTALL_DIR "/plugins/"); 00079 break; 00080 case 's': 00081 if (strcmp("services", type) == 0) 00082 return QFile::decodeName(SERVICES_INSTALL_DIR "/"); 00083 if (strcmp("servicetypes", type) == 0) 00084 return QFile::decodeName(SERVICETYPES_INSTALL_DIR "/"); 00085 if (strcmp("sound", type) == 0) 00086 return QFile::decodeName(SOUND_INSTALL_DIR "/"); 00087 break; 00088 case 't': 00089 if (strcmp("templates", type) == 0) 00090 return QFile::decodeName(TEMPLATES_INSTALL_DIR "/"); 00091 break; 00092 case 'w': 00093 if (strcmp("wallpaper", type) == 0) 00094 return QFile::decodeName(WALLPAPER_INSTALL_DIR "/"); 00095 break; 00096 case 'x': 00097 if (strcmp("xdgconf-menu", type) == 0) 00098 return QFile::decodeName(SYSCONF_INSTALL_DIR "/xdg/menus/"); 00099 if (strcmp("xdgdata-apps", type) == 0) 00100 return QFile::decodeName(XDG_APPS_INSTALL_DIR "/"); 00101 if (strcmp("xdgdata-dirs", type) == 0) 00102 return QFile::decodeName(XDG_DIRECTORY_INSTALL_DIR "/"); 00103 break; 00104 } 00105 return QString(); 00106 }
KDE 4.6 API Reference