1 /***************************************************************************
2 * Copyright (C) 1992-2007 Trolltech ASA *
4 * Copyright (C) 2005-2007 by Tarek Saidi *
5 * tarek.saidi@arcor.de *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; version 2 of the License. *
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 *
18 * Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
25 void initAppPaths(int argc,char** argv){
28 wchar_t module_name[256];
29 GetModuleFileNameW(0, module_name, sizeof(module_name) / sizeof(wchar_t));
30 filePath = QString::fromUtf16((ushort *)module_name);
32 char module_name[256];
33 GetModuleFileNameA(0, module_name, sizeof(module_name));
34 filePath = QString::fromLocal8Bit(module_name);
36 AppDir = filePath.filePath();
37 AppDir.truncate(AppDir.lastIndexOf("/"));
39 HomeDir = QString::fromLocal8Bit(qgetenv("APPDATA").constData());
40 if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
41 HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
43 HomeDir = QDir::homePath()+"/KeePassX";
45 DataDir=AppDir+"/share";