public static async Task CreateDirectoryIfNotThere(this IStorageServiceHandler storageService, string path) { if (!await storageService.DirectoryExistsAsync(path)) { await storageService.CreateDirectoryAsync(path); } }
public static async Task MoveFileIfExists(this IStorageServiceHandler storageService, string source, string destination, bool overwrite) { if (await storageService.FileExistsAsync(source)) { var destinationFolder = Path.GetDirectoryName(destination); if (!await storageService.DirectoryExistsAsync(destinationFolder)) { await storageService.CreateDirectoryAsync(destinationFolder); } await storageService.MoveFileAsync(source, destination, overwrite); } }