Quantcast

IsolatedStorage or OpenFileOutput?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

IsolatedStorage or OpenFileOutput?

little_bigben
Hi everyone,

I would like to access to the file system (only to store small things like
using IsolatedStorage on WP7).

If I well understand, to create a file I have to do this:
IsolatedStorageFile file = IsolatedStorageFile.
GetUserStoreForAssembly();
file.CreateFile(filename);

But an exception occured: "System.UnauthorizedAccessException: Access to
the path "/data/data/XXXX/files/.config" is denied."

I searched on the documentation, stackoverflow, etc. but I didn't find
solution.
So I tried an other way with OpenFileOutput.

To open a file I did this:
Stream fos = context.OpenFileOutput(filename,
Android.Content.FileCreationMode.Private);

But a FileNotFoundException occured. I search over the documentation and
found nothing that help me.

I want only access file for my application (not external).

Thanks for your answers,

PS: I already tried to desactivate the fast deployment but doesn't work. And I work under the version  2.1 of Android.

--
Benjamin Baldacci linkedin
Mobile : +33 6 32 45 63 79

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: IsolatedStorage or OpenFileOutput?

little_bigben
Jonathan Pryor andswered me on the IRC chan.

For people who encouter the same problem:

- Open the Windows cmd.
- Locate the file adb (on the plateform-tools for me so C:\Program Files (x86)\Android\android-sdk\platform-tools)
- Go to this folder.
- Type the command: adb shell ls -l /data/data/@package.name@ (replace @package.name@ by your packagename, you can find it in your project ManifestFile, if it is not created then create it).
- If the permissions on the files are root not the same as the cache (like this:
drwxrwx--x app_30 app_30 2011-12-30 17:22 cache
drwxrwxr-x root root 2011-12-30 17:22 files
)
then type this command line: adb shell chown app_30 /data/data/@package.name@/files
(replace app_30 by your cache rights).

It solve the problem for me.

Thanks to Jonathan,

--
Benjamin Baldacci linkedin
Mobile : +33 6 32 45 63 79


On Tue, Jan 3, 2012 at 09:44, Benjamin Baldacci <[hidden email]> wrote:
Hi everyone,

I would like to access to the file system (only to store small things like
using IsolatedStorage on WP7).

If I well understand, to create a file I have to do this:
IsolatedStorageFile file = IsolatedStorageFile.
GetUserStoreForAssembly();
file.CreateFile(filename);

But an exception occured: "System.UnauthorizedAccessException: Access to
the path "/data/data/XXXX/files/.config" is denied."

I searched on the documentation, stackoverflow, etc. but I didn't find
solution.
So I tried an other way with OpenFileOutput.

To open a file I did this:
Stream fos = context.OpenFileOutput(filename,
Android.Content.FileCreationMode.Private);

But a FileNotFoundException occured. I search over the documentation and
found nothing that help me.

I want only access file for my application (not external).

Thanks for your answers,

PS: I already tried to desactivate the fast deployment but doesn't work. And I work under the version  2.1 of Android.

--
Benjamin Baldacci linkedin
Mobile : +33 6 32 45 63 79


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: IsolatedStorage or OpenFileOutput?

Jonathan Pryor-2
In reply to this post by little_bigben
On Jan 3, 2012, at 3:44 AM, Benjamin Baldacci wrote:
> But an exception occured: "System.UnauthorizedAccessException: Access to the path "/data/data/XXXX/files/.config" is denied."

_Normally_ this is caused by the combination of fast deployment and running on an emulator. This doesn't happen on hardware, and this _shouldn't_ happen when fast deployment is disabled [0].

 - Jon

[0] Oddly in this case fast deployment _was_ disabled, yet it continued to be wrong. Perhaps an explicit app package removal needed to be performed before re-installing the (non-fast deployment-built) package?

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: IsolatedStorage or OpenFileOutput?

little_bigben
Maybe, I didn't try to uninstall the app on the emulator.

--
Benjamin Baldacci linkedin
Mobile : +33 6 32 45 63 79


On Tue, Jan 3, 2012 at 20:23, Jonathan Pryor <[hidden email]> wrote:
On Jan 3, 2012, at 3:44 AM, Benjamin Baldacci wrote:
> But an exception occured: "System.UnauthorizedAccessException: Access to the path "/data/data/XXXX/files/.config" is denied."

_Normally_ this is caused by the combination of fast deployment and running on an emulator. This doesn't happen on hardware, and this _shouldn't_ happen when fast deployment is disabled [0].

 - Jon

[0] Oddly in this case fast deployment _was_ disabled, yet it continued to be wrong. Perhaps an explicit app package removal needed to be performed before re-installing the (non-fast deployment-built) package?

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Loading...