[mono-android] Deleting files on external storage?

hdortim hdortim at gmx.net
Tue Mar 29 12:40:41 EDT 2011


Hi,

I have the same problem with preview 14. I can create a file but not 
delete after the create.

My Directory (GetExternalFilesDir()) points to 
*"/mnt/sdcard/Android/data/com.mengit/files/test.txt"* and the problem 
seems to be the "*File.Delete()*" call.
adb Debug message says:
*Access to the path "/mnt/sdcard/Android/data/com.mengit/files/test.txt" 
is denied.*

And yes, I have "*WRITE_EXTERNAL_STORAGE*" permission enabled.

Regards,

h.dortim

Am 29.03.2011 17:25, schrieb Mike Kestner:
> What does the output of context.GetExternalFilesDir point at, and can
> you guys create AND delete files created there?
>
> Mike
>
> On Tue, 2011-03-29 at 16:22 +0200, Carlo Bolz wrote:
>> I am experienced the same behaviour – but can´t resolve it.
>>
>>
>>
>> Regards,
>>
>> Carlo
>>
>>
>>
>> Von: monodroid-bounces at lists.ximian.com
>> [mailto:monodroid-bounces at lists.ximian.com] Im Auftrag von Jon
>> Valvatne
>> Gesendet: Dienstag, 29. März 2011 11:07
>> An: Jb Evain
>> Cc: monodroid at lists.ximian.com
>> Betreff: Re: [mono-android] Deleting files on external storage?
>>
>>
>>
>>
>> Oops - looks like I created a too-simple test case. This also fails in
>> the same way, though:
>>
>>
>>
>>
>>                  System.IO.FileStream fs =
>> System.IO.File.Create("/sdcard/test.txt");
>>
>>
>>                  fs.Close();
>>
>>
>>                  System.IO.File.Delete("/sdcard/test.txt");
>>
>>
>>
>>
>> On Tue, Mar 29, 2011 at 11:00 AM, Jb Evain<jbevain at gmail.com>  wrote:
>>
>> Hi,
>>
>>
>> On Tue, Mar 29, 2011 at 10:51 AM, Jon Valvatne<jon at norsync.com>
>> wrote:
>>>                  System.IO.File.Create("/sdcard/test.txt");
>>>                  System.IO.File.Delete("/sdcard/test.txt");
>>>
>>
>>> Has anyone successfully deleted a file off external storage from C#
>> code?
>>
>>
>> Have you properly disposed the created file stream (using either the
>> Close or Dispose method, or the using pattern on it) before trying to
>> delete the actual file?
>>
>> Jb
>>
>>
>>
>>
>>
>> _______________________________________________
>> Monodroid mailing list
>> Monodroid at lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110329/e236be32/attachment.html 


More information about the Monodroid mailing list