- Home /
Question by
badescuga9 · Jan 10, 2014 at 11:59 AM ·
.net
accesing filestream denied for SharpZipLib for Unity3d iOS
i am trying to unpack a .zip file but when i try to copy the zip stream to the file i get:
UnauthorizedAccessException: Access to the path "/var/mobile/Applications/7209CA86-E88D-4BAC-B285-2912B982E8C0/Documents/Inbox/Book.txt" is denied.
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [0x00000] in <filename unknown>:0
at System.IO.File.Create (System.String path, Int32 bufferSize) [0x00000] in <filename unknown>:0
at System.IO.File.Create (System.String path) [0x00000] in <filename unknown>:0
Book.txt
is a file of the .zip file.
Here is the code where the problem appears:
using (FileStream streamWriter = File.Create(fullZipToPath)) {
StreamUtils.Copy(zipStream, streamWriter, buffer);
}
The code works well on OS X but on iOS i can't get it fixed. What is the problem?
Comment
Answer by pahe · Apr 14, 2014 at 08:40 AM
What's the "fullZipToPath" path? You have to use Application.persistentDataPath in order to have access to that file. On mobile devices, paths to files are restricted by the OS, which is not that restricted on the standalone platforms.
Your answer
![](https://koobas.hobune.stream/wayback/20220613130024im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity3d and .net framework 4.0 0 Answers
Cloud recognition in Vuforia 0 Answers
`System.IO.File' does not contain a definition for `AppendText'? 1 Answer
Unity 3D and Databases? 1 Answer