Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Bogatov <egorbo@gmail.com>2020-03-31 17:23:20 +0300
committerGitHub <noreply@github.com>2020-03-31 17:23:20 +0300
commit372bf426f1e10c2ccab3446cc0043edc86bcad01 (patch)
tree16b8a6259bb16067baa7f2746c86180fc49ac99c /src/libraries/Native/Unix/System.Native/pal_searchpath.m
parentbe469ad6b432fe10156cfbbc13ddc67b78a91024 (diff)
[mono] Implement Environment.GetFolderPath on iOS (#34022)
* Implement Environment.GetFolderPath on iOS * Address feedback * Move GetFolderPathCore to Environment.Unix.GetFolderPathCore.cs * Fix build issue * Address feedback * cache all special directories * Fix build issue * remove a whitespace * Fix UserProfile issue * undo changes in GetEnvironmentVariableCore * Update Environment.Unix.Mono.cs * Extract to InternalGetEnvironmentVariable * Fix build issue * Return emtpy string if underlying native function returns null * Add nullability
Diffstat (limited to 'src/libraries/Native/Unix/System.Native/pal_searchpath.m')
-rw-r--r--src/libraries/Native/Unix/System.Native/pal_searchpath.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libraries/Native/Unix/System.Native/pal_searchpath.m b/src/libraries/Native/Unix/System.Native/pal_searchpath.m
new file mode 100644
index 00000000000..a4f150da764
--- /dev/null
+++ b/src/libraries/Native/Unix/System.Native/pal_searchpath.m
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "pal_searchpath.h"
+#import <Foundation/Foundation.h>
+
+const char* SystemNative_SearchPath(int32_t folderId)
+{
+ NSSearchPathDirectory spd = (NSSearchPathDirectory) folderId;
+ NSURL* url = [[[NSFileManager defaultManager] URLsForDirectory:spd inDomains:NSUserDomainMask] lastObject];
+ const char* path = [[url path] UTF8String];
+ return path == NULL ? NULL : strdup (path);
+}