[mono-android] Deleting files on external storage?

Carlo Bolz cb at dm-edv.de
Wed Mar 30 05:13:17 EDT 2011


What happens with file handles on android in general?

Files and directories can be created here: Android.OS.Environment.ExternalStorageDirectory.
Maybe it belongs only tot he external storage.

If I write to System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) it is possible to delete the created file.

Regards
Carlo




-----Ursprüngliche Nachricht-----
Von: monodroid-bounces at lists.ximian.com [mailto:monodroid-bounces at lists.ximian.com] Im Auftrag von Mike Kestner
Gesendet: Dienstag, 29. März 2011 17:25
An: monodroid at lists.ximian.com
Betreff: Re: [mono-android] Deleting files on external storage?

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





More information about the Monodroid mailing list