mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
misc.cpp: Fix compilation on Mac OS X
This commit is contained in:
parent
2283bd2358
commit
96c918ff8d
1 changed files with 1 additions and 17 deletions
18
src/misc.cpp
18
src/misc.cpp
|
@ -59,7 +59,6 @@ const int UNLEN = 256;
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <Cocoa/Cocoa.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
|
@ -113,9 +112,6 @@ QString misc::QDesktopServicesDataLocation() {
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html
|
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
|
||||||
NSString *dataDirectory =
|
|
||||||
FSRef ref;
|
FSRef ref;
|
||||||
OSErr err = FSFindFolder(kUserDomain, kApplicationSupportFolderType, false, &ref);
|
OSErr err = FSFindFolder(kUserDomain, kApplicationSupportFolderType, false, &ref);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -204,19 +200,7 @@ QString misc::QDesktopServicesDownloadLocation() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
// TODO: How to support this on Mac OS X?
|
||||||
NSString *applicationDirectory = [paths objectAtIndex:0];
|
|
||||||
NSRange range;
|
|
||||||
range.location = 0;
|
|
||||||
range.length = [applicationDirectory length];
|
|
||||||
QString path(range.length, QChar(0));
|
|
||||||
|
|
||||||
unichar *chars = new unichar[range.location];
|
|
||||||
[nsstr getCharacters:chars range:range];
|
|
||||||
QString path = QString::fromUtf16(chars, range.length);
|
|
||||||
delete chars;
|
|
||||||
path += QLatin1Char('/') + qApp->applicationName();
|
|
||||||
return path;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue