Пример #1
0
 string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "Data")
 {
     NSError err;
     
     var fm = new NSFileManager();
     var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out err);
     var ret = Path.Combine(url.RelativePath, NSBundle.MainBundle.BundleIdentifier, subDir);
     if (!Directory.Exists(ret)) Directory.CreateDirectory(ret);
     
     return ret;
 }
Пример #2
0
        string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "BlobCache")
        {
            NSError err;

            var fm = new NSFileManager();
            var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out err);
            var ret = Path.Combine(url.RelativePath, BlobCache.ApplicationName, subDir);
            if (!Directory.Exists(ret)) _inner.CreateRecursive(ret).Wait();

            return ret;
        }
Пример #3
0
        static string GetDirectory(NSSearchPathDirectory directory)
        {
            var dirs = NSSearchPath.GetDirectories(directory, NSSearchPathDomain.User);

            if (dirs == null || dirs.Length == 0)
            {
                // this should never happen...
                return(null);
            }
            return(dirs[0]);
        }
        static string GetDirectory(NSSearchPathDirectory directory)
        {
            var dirs = NSSearchPath.GetDirectories(directory, NSSearchPathDomain.User);

            if (dirs == null || dirs.Length == 0)
            {
                // this should never happen...
                throw new NotSupportedException("this should never happen...");
                //return null;
            }
            return(dirs[0]);
        }
        private string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "BlobCache")
        {
            using (var fm = new NSFileManager())
            {
                var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out _);
                var ret = Path.Combine(url.RelativePath, BlobCache.ApplicationName, subDir);
                if (!Directory.Exists(ret))
                {
                    _inner.CreateRecursive(ret).Wait();
                }

                return(ret);
            }
        }
Пример #6
0
        private static string IosFolderPathDocuments(NSSearchPathDirectory nsSearchpath, Environment.SpecialFolder path)
        {
            string folderPath;

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                folderPath = NSFileManager.DefaultManager.GetUrls(nsSearchpath, NSSearchPathDomain.User)[0].Path;
            }
            else
            {
                folderPath = Environment.GetFolderPath(path);
            }

            return(folderPath);
        }
Пример #7
0
		void Convert (EtoSpecialFolder folder, out NSSearchPathDirectory dir, out NSSearchPathDomain domain)
		{
			switch (folder) {
			case EtoSpecialFolder.ApplicationSettings:
				dir = NSSearchPathDirectory.ApplicationSupportDirectory;
				domain = NSSearchPathDomain.User;
				break;
			case EtoSpecialFolder.Documents:
				dir = NSSearchPathDirectory.DocumentDirectory;
				domain = NSSearchPathDomain.User;
				break;
			default:
				throw new NotSupportedException ();
			}
		}
        string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "Data")
        {
            NSError err;

            var fm  = new NSFileManager();
            var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out err);
            var ret = Path.Combine(url.RelativePath, NSBundle.MainBundle.BundleIdentifier, subDir);

            if (!Directory.Exists(ret))
            {
                Directory.CreateDirectory(ret);
            }

            return(ret);
        }
Пример #9
0
        void Convert(EtoSpecialFolder folder, out NSSearchPathDirectory dir, out NSSearchPathDomain domain)
        {
            switch (folder)
            {
            case EtoSpecialFolder.ApplicationSettings:
                dir    = NSSearchPathDirectory.ApplicationSupportDirectory;
                domain = NSSearchPathDomain.User;
                break;

            case EtoSpecialFolder.Documents:
                dir    = NSSearchPathDirectory.DocumentDirectory;
                domain = NSSearchPathDomain.User;
                break;

            default:
                throw new NotSupportedException();
            }
        }
Пример #10
0
 public static string[] GetDirectories(NSSearchPathDirectory directory, NSSearchPathDomain domainMask, bool expandTilde = true)
 {
     return(NSArray.StringArrayFromHandle(NSSearchPathForDirectoriesInDomains((nuint)(ulong)directory, (nuint)(ulong)domainMask, expandTilde)));
 }
Пример #11
0
        public static string[] SearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, bool expandTilde)
        {
            var handle = NSSearchPathForDirectoriesInDomains(directory, domainMask, expandTilde);

            return(NSArray.StringArrayFromHandle(handle));
        }
Пример #12
0
        internal static string FirstSearchPathFor(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask = NSSearchPathDomainMask.NSUserDomainMask, bool expandTilde = true)
        {
            var paths = SearchPathForDirectoriesInDomains(directory, domainMask, expandTilde);

            return(paths.Length > 0 ? paths[0] : null);
        }
Пример #13
0
 internal extern static IntPtr NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, [MarshalAs(UnmanagedType.U1)] bool expandTilde);
Пример #14
0
 private static NSArray NSSearchPathForDirectoriesInDomains(
     NSSearchPathDirectory directory,
     NSSearchPathDomainMask domainMask,
     bool expandTilde)
 {
     return (NSArray)NSArray.Alloc().Init();
 }
Пример #15
0
 static DirectoryInfo ToDirectory(NSSearchPathDirectory dir)
 => new DirectoryInfo(NSSearchPath.GetDirectories(dir, NSSearchPathDomain.User).First());
Пример #16
0
 extern static IntPtr  NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomain domainMask, bool expandTilde);
Пример #17
0
 public static NSArray NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, bool expandTilde)
 {
     return NativeMethods.NSSearchPathForDirectoriesInDomains(directory, domainMask, expandTilde).To<NSArray>();
 }
Пример #18
0
 public static extern IntPtr NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, [MarshalAs(UnmanagedType.U1)] bool expandTilde);
Пример #19
0
		static extern IntPtr NSSearchPathForDirectoriesInDomains (NSSearchPathDirectory directory, NSSearchPathDomain domainMask, bool expandTilde);
Пример #20
0
		public static string[] GetDirectories (NSSearchPathDirectory directory, NSSearchPathDomain domainMask, bool expandTilde)
		{
			IntPtr values = NSSearchPathForDirectoriesInDomains(directory, domainMask, expandTilde);
			return NSArray.StringArrayFromHandle (values);
		}
Пример #21
0
 internal static extern string?SearchPath(NSSearchPathDirectory folderId);
 private string GetPath(NSSearchPathDirectory directory)
 {
     return(NSSearchPath.GetDirectories(directory, NSSearchPathDomain.User).FirstOrDefault());
 }
Пример #23
0
 public virtual AnyObject[] URLsForDirectory(NSSearchPathDirectory directory, NSSearchPathDomainMask inDomains)
 {
     return(default(AnyObject[]));
 }
Пример #24
0
 public static string[] GetDirectories(NSSearchPathDirectory directory, NSSearchPathDomain domainMask, bool expandTilde = true)
 {
     return NSArray.StringArrayFromHandle (NSSearchPathForDirectoriesInDomains ((nuint)(ulong)directory, (nuint)(ulong)domainMask, expandTilde));
 }
Пример #25
0
 public virtual NSURL URLForDirectory(NSSearchPathDirectory directory, NSSearchPathDomainMask inDomain, [Optional] NSURL appropriateForURL, bool create, NSErrorPointer error)
 {
     return(default(NSURL));
 }
Пример #26
0
 public virtual bool GetRelationship(UnsafeMutablePointer <NSURLRelationship> outRelationship, NSSearchPathDirectory ofDirectory, NSSearchPathDomainMask inDomain, NSURL toItemAtURL, NSErrorPointer error)
 {
     return(default(bool));
 }
Пример #27
0
        public static string[] GetDirectories(NSSearchPathDirectory directory, NSSearchPathDomain domainMask, bool expandTilde)
        {
            IntPtr values = NSSearchPathForDirectoriesInDomains(directory, domainMask, expandTilde);

            return(NSArray.StringArrayFromHandle(values));
        }
Пример #28
0
 public static string SearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, bool expandTilde)
 {
     return(NSString.FromHandle(NSSearchPathForDirectoriesInDomains(directory, domainMask, expandTilde)));
 }
Пример #29
0
 internal static partial string?SearchPath(NSSearchPathDirectory folderId);
Пример #30
0
 private string GetPath(NSSearchPathDirectory directory)
 {
     //We should only have one....
     return(NSSearchPath.GetDirectories(directory, NSSearchPathDomain.User)[0]);
 }