[Mono-osx] How to write files to (and read from) special folders

Richard de Zwart mountain at xs4all.nl
Tue Dec 28 14:31:44 EST 2010


Dear all,

When I write a file without a path it ends up in the root of my machine. 
Code like this :

File.WriteAllText("foo.txt", "This is some text");

creates a file "/foo.txt".

I would like to write into the app folder of my application, maybe by 
using some Environment.SpecialFolder enum like I use in a MonoTouch 
application. But the available enumerations give me machine-wide paths 
like "/Users/Shared".

When I want the open a file that I marked as "Content" in my solution in 
MonoDevelop I need to specify the entire path to my bin/Debug directory. 
Which of course will not work when I deploy my app.

Apparently the context of my running application is the root. Can I 
change that?


Thanks,

Richard


More information about the Mono-osx mailing list