Esempio n. 1
0
        // DO NOT CHANGE Environment.ApplicationDataPath to another path.  This is used to pass EmbeddedResource Fonts to UWP Text elements and there is zero flexibility here.
        public static string FolderPath(Assembly assembly, string folderName = null)
        {
            DirectoryExtensions.AssureExists(Environment.ApplicationDataPath);
            var root = Path.Combine(Environment.ApplicationDataPath, LocalStorageFolderName);

            DirectoryExtensions.AssureExists(root);
            if (assembly != null)
            {
                root = Path.Combine(root, assembly.GetName().Name);
                DirectoryExtensions.AssureExists(root);
            }

            if (string.IsNullOrWhiteSpace(folderName))
            {
                return(root);
            }

            var folderPath = Path.Combine(root, folderName);

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

            return(folderPath);
        }
Esempio n. 2
0
        static string FolderPath(string folderName)
        {
            DirectoryExtensions.AssureExists(Environment.ApplicationCachePath);
            var root = Path.Combine(Environment.ApplicationCachePath, DownloadStorageFolderName);

            DirectoryExtensions.AssureExists(root);

            if (string.IsNullOrWhiteSpace(folderName))
            {
                return(root);
            }

            var folderPath = Path.Combine(root, folderName);

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

            return(folderPath);
        }