mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1174704 - Implement GetUserDataDirectoryHome for iOS. r=froydnj
This commit is contained in:
parent
94337e6cfe
commit
f0b352a2e0
13
toolkit/xre/UIKitDirProvider.h
Normal file
13
toolkit/xre/UIKitDirProvider.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef TOOLKIT_XRE_UIKITDIRPROVIDER_H_
|
||||
#define TOOLKIT_XRE_UIKITDIRPROVIDER_H_
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
bool GetUIKitDirectory(bool aLocal, nsACString& aUserDir);
|
||||
|
||||
#endif // TOOLKIT_XRE_UIKITDIRPROVIDER_H_
|
19
toolkit/xre/UIKitDirProvider.mm
Normal file
19
toolkit/xre/UIKitDirProvider.mm
Normal file
@ -0,0 +1,19 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include "UIKitDirProvider.h"
|
||||
|
||||
bool GetUIKitDirectory(bool aLocal, nsACString& aUserDir)
|
||||
{
|
||||
NSSearchPathDirectory directory = aLocal ? NSCachesDirectory : NSApplicationSupportDirectory;
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES);
|
||||
if ([paths count] == 0) {
|
||||
return false;
|
||||
}
|
||||
aUserDir = [[paths objectAtIndex:0] UTF8String];
|
||||
return true;
|
||||
}
|
@ -40,6 +40,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
'MacLaunchHelper.mm',
|
||||
'nsNativeAppSupportCocoa.mm',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
|
||||
UNIFIED_SOURCES += [
|
||||
'nsNativeAppSupportDefault.cpp',
|
||||
'UIKitDirProvider.mm',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
EXPORTS += ['nsQAppInstance.h']
|
||||
SOURCES += [
|
||||
|
@ -52,6 +52,9 @@
|
||||
#ifdef XP_UNIX
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#ifdef XP_IOS
|
||||
#include "UIKitDirProvider.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#define APP_REGISTRY_NAME "Application Registry"
|
||||
@ -1235,6 +1238,14 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
localDir = do_QueryInterface(dirFileMac, &rv);
|
||||
#elif defined(XP_IOS)
|
||||
nsAutoCString userDir;
|
||||
if (GetUIKitDirectory(aLocal, userDir)) {
|
||||
rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir));
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#elif defined(XP_WIN)
|
||||
nsString path;
|
||||
if (aLocal) {
|
||||
|
Loading…
Reference in New Issue
Block a user