Reputation: 1141
I am developing an app "Bible Lite" which has bible in XML in 17 different languages. To save space i have zipped it into archived.zip inside Assets folder. I want to unzip the folder containing the Bible in different languages and store it in the LocalFolder once the user has downloaded it and begins running it for the first time.
While unzipping files on Win32 apps is trivial tasks I am having a hard time doing it in jailed environment of UWP. I have tried digging stack overflow.
I just have a folder containing bible in various languages inside my Zip.
private static async Task extractCompressedFile(StorageFolder destinationFolder)
{
StorageFolder _folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Assets");
/*fails here FileNotFound*/ StorageFile sourceCompressedFile = await _folder.GetFileAsync("archived.zip");
ZipFile.ExtractToDirectory(sourceCompressedFile.Path, destinationFolder.Path);
}
}
Upvotes: 1
Views: 656
Reputation: 3286
You can set the property of archived.zip
in the Properties window. And set the Build Action from None to Content like the following image:
None: The file is not included in the package manifest. An example is a text file that contains documentation, such as a Readme file.
Content: The file is included in the package manifest. For example, this setting is the default value for an .htm, .js, .css, image, audio, or video file.
The default value of the .zip file is None.
Upvotes: 0
Reputation: 1942
You need to set the "archived.zip" file 's "Copy to Output Directory" to "Copy always"
Upvotes: 1