[mono-android] Deleting files on external storage?

Jonathan Pobst monkey at jpobst.com
Wed Mar 30 10:58:18 EDT 2011


I think we are going to have to do something on the backend to fix this. 
  Can you see if the following works for you?

Instead of:
System.IO.File.Delete (file);

try:
var fs = new Java.IO.File (file);
fs.Delete ();

Jonathan

On 3/30/2011 1:55 AM, Jon Valvatne wrote:
> On Tue, Mar 29, 2011 at 5:25 PM, Mike Kestner <mkestner at novell.com
> <mailto:mkestner at novell.com>> wrote:
>
>     What does the output of context.GetExternalFilesDir point at, and can
>     you guys create AND delete files created there?
>
> In my case Android.OS.Environment.ExternalStorageDirectory is set to
> /mnt/sdcard, and trying to create/delete /mnt/sdcard/test.txt still
> fails on the delete in the same way.
>
> So the latest test case is:
>
>                  String file =
> Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/test.txt";
>                  System.IO.FileStream fs = System.IO.File.Create(file);
>                  fs.Close();
>                  System.IO.File.Delete(file);
>
>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid



More information about the Monodroid mailing list