[Mono-bugs] [Bug 684172] New: System.IO.File.Delete doesn't work

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 31 10:52:24 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=684172

https://bugzilla.novell.com/show_bug.cgi?id=684172#c0


           Summary: System.IO.File.Delete doesn't work
    Classification: Mono
           Product: MonoDroid
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: jpryor at novell.com
        ReportedBy: jpobst at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


System.IO can be used to create a file:

var storage = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
var file1 = Path.Combine (storage, "Download", "test.txt");

System.IO.FileStream fs = System.IO.File.Create (file1);
fs.Close ();


However, it cannot be used to delete a file:

System.IO.File.Delete (file1);

Fails with:
Access to the path "/mnt/sdcard/..." is denied.


You can successfully delete the file using Java APIs:

var fs2 = new Java.IO.File (file1);
fs2.Delete ();

Note you need the "android.permission.WRITE_EXTERNAL_STORAGE" permission in
your manifest.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list