[Mono-bugs] [Bug 531553] New: Bundle path should be implicit and hidden from MonoTouch applications

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Aug 15 22:25:30 EDT 2009


           Summary: Bundle path should be implicit and hidden from
                    MonoTouch applications
    Classification: Mono
           Product: MonoTouch
           Version: SVN
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: gnorton at novell.com
        ReportedBy: chris at foundation42.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:
Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)

File operations (like File.OpenRead() etc) already seem to be using
IsolatedStorage.  However the root of the IsolatedStorage appears to be "/"
instead of the Bundle path.

I believe this is incorrect since my application shouldn't have to know (or
even be allowed to know) the base path to the Bundle.

Changing the API to implicitly use the Bundle path will increase security and
simplify the user programming experience.

Security will be increased since there won't be a way to mess around with files
outside the bundle.  The programming model will be better because I can
File.OpenRead("MyFile.foo") instead of having to specify the entire bundle

Reproducible: Always

Steps to Reproduce:
1. Create a new MonoTouch APP
2. Add a text file to the solution called "Foo.txt"
3. Mark the file as "Content", "Copy if Newer"
4. In your application do

string str = File.ReadAllText("Foo.txt");

5. Run your application and not there is a "File not found" exception
6. Change the code to read

string filePath = Path.Combine(NSBundle.MainBundle.BundlePath, "Foo.txt");
string str = File.ReadAllText(filePath);

7. Run the application again and notice that it works

Actual Results:  
File not found exception

Expected Results:  
The file should be opened :)

Rumor has it that the behavior I propose is different from CocoaTouch. 
Nevertheless I think this is the correct behavior for MonoTouch.

Configure bugmail: http://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