public static Task <StorageFile> GetFileFromPathAsync(string path) { if (StorageVirtualHelper.IsVirtualPath(path)) { var folder = StorageVirtualHelper.GetVirtualFolder(ref path); return(GetFileAsync(path, folder)); } return(StorageFile.GetFileFromPathAsync(path).AsTask()); }
public static async Task <StorageFile> CreateFileFromPathAsync( string path, CreationCollisionOption option = CreationCollisionOption.OpenIfExists) { StorageFolder folder; if (StorageVirtualHelper.IsVirtualPath(path)) { folder = StorageVirtualHelper.GetVirtualFolder(ref path); } else { var folderPath = path.Substring(0, path.LastIndexOf("/", StringComparison.Ordinal) + 1); path = path.Replace(folderPath, ""); folder = await StorageFolder.GetFolderFromPathAsync(folderPath); } return(await CreateFileAsync(path, folder, option)); }