fixed mac specific build problem

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@158 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 16 years ago
parent 8b08b321a5
commit fecd1109b3
  1. 28
      src/main.cpp
  2. 1
      src/src.pro

@ -31,6 +31,9 @@
#include <QProcess>
#include <QDesktopServices>
#include <QUrl>
#include <QCoreApplication>
#include <QVarLengthArray>
/*
#include <QLibary>
@ -55,6 +58,9 @@
#ifdef Q_WS_WIN
#include <windows.h>
#endif
#ifdef Q_WS_MAC
#include <Carbon/Carbon.h>
#endif
using namespace std;
@ -496,13 +502,21 @@ QString applicationFilePath()
return filePath.filePath();
#elif defined(Q_WS_MAC)
QString qAppFileName_str = qAppFileName();
if(!qAppFileName_str.isEmpty()) {
QFileInfo fi(qAppFileName_str);
return fi.exists() ? fi.canonicalFilePath() : QString();
}
#endif
#if defined( Q_OS_UNIX )
CFURLRef bundleURL(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
assert(bundleURL);
CFStringRef cfPath(CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle));
assert(cfPath);
CFIndex length = CFStringGetLength(cfPath);
const UniChar *chars = CFStringGetCharactersPtr(cfPath);
if (chars)
return QString(reinterpret_cast<const QChar *>(chars), length);
QVarLengthArray<UniChar> buffer(length);
CFStringGetCharacters(cfPath, CFRangeMake(0, length), buffer.data());
return QString(reinterpret_cast<const QChar *>(buffer.constData()), length);
#elif defined( Q_OS_UNIX )
#ifdef Q_OS_LINUX
// Try looking for a /proc/<pid>/exe symlink first which points to
// the absolute path of the executable

@ -50,6 +50,7 @@ macx {
isEmpty(PREFIX):PREFIX = /Applications
target.path = $${PREFIX}
data.path = $${PREFIX}/keepassx.app/Contents/share/keepass
LIBS += -framework CoreFoundation
}
isEqual(QMAKE_WIN32,1) {