fixed mac specific build problem
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@158 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
8b08b321a5
commit
fecd1109b3
28
src/main.cpp
28
src/main.cpp
|
@ -31,6 +31,9 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QVarLengthArray>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#include <QLibary>
|
#include <QLibary>
|
||||||
|
@ -55,6 +58,9 @@
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -496,13 +502,21 @@ QString applicationFilePath()
|
||||||
|
|
||||||
return filePath.filePath();
|
return filePath.filePath();
|
||||||
#elif defined(Q_WS_MAC)
|
#elif defined(Q_WS_MAC)
|
||||||
QString qAppFileName_str = qAppFileName();
|
|
||||||
if(!qAppFileName_str.isEmpty()) {
|
CFURLRef bundleURL(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
|
||||||
QFileInfo fi(qAppFileName_str);
|
assert(bundleURL);
|
||||||
return fi.exists() ? fi.canonicalFilePath() : QString();
|
CFStringRef cfPath(CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle));
|
||||||
}
|
assert(cfPath);
|
||||||
#endif
|
CFIndex length = CFStringGetLength(cfPath);
|
||||||
#if defined( Q_OS_UNIX )
|
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
|
#ifdef Q_OS_LINUX
|
||||||
// Try looking for a /proc/<pid>/exe symlink first which points to
|
// Try looking for a /proc/<pid>/exe symlink first which points to
|
||||||
// the absolute path of the executable
|
// the absolute path of the executable
|
||||||
|
|
|
@ -50,6 +50,7 @@ macx {
|
||||||
isEmpty(PREFIX):PREFIX = /Applications
|
isEmpty(PREFIX):PREFIX = /Applications
|
||||||
target.path = $${PREFIX}
|
target.path = $${PREFIX}
|
||||||
data.path = $${PREFIX}/keepassx.app/Contents/share/keepass
|
data.path = $${PREFIX}/keepassx.app/Contents/share/keepass
|
||||||
|
LIBS += -framework CoreFoundation
|
||||||
}
|
}
|
||||||
|
|
||||||
isEqual(QMAKE_WIN32,1) {
|
isEqual(QMAKE_WIN32,1) {
|
||||||
|
|
Loading…
Reference in New Issue