…
Process.Start (“file:///home/”);
Did a bit of IRC channel ping-pong today. Went over to #f-spot to ask a user-related question about f-spot, and got pulled in by curiosity on a totally unrelated topic: opening a folder with the default file-manager. Initiated some discussion on #mono and discovered this was, in fact, not trivial – which seemed odd. But I’ve never personally written any C#, or much desktop code at all, for that matter. So I started playing around with various suggestions from the good folks in #mono, and writing my very first C# application.
(Yeah, basically a one-liner. You gotta start somewhere! ^_^) Anyway, for something so simple, there seemed to be a lot of uncertainty and discussion about it (even from the man, himself! – He claims his memory is fading…), so I figure it’s worth documenting. More info can be seen here under Process.
On FreeDesktop systems it will use xdg-open, if not, it will try to use gnome-open or kfmclient to open the files.
Not sure if this will work on Windows. The file://
prefix is required.
Update: According to ccoish, this will work on Windows.
Passing this info back to #f-spot resulted in a patch to allow you to open the folder containing your photo. Thanks, Gabriel! Open source is cool. 🙂
Not sure if I’ll look at C#/Mono much more, was kinda gonna do the Python thing for a while… but this was a fun distraction. 🙂
- Posted on Monday, July 23rd, 2007 at 5:00 pm.
- Filed under: Geek, Projects.
- Tagged with: C#, Code, FLOSS, Gnome, How to, Linux, Mono, Programming.
- Subscribe to comments for this post (RSS)
- Respond with a comment or trackback from your own site.
July 23rd, 2007 at 8:38 pm
Ufo2k
November 22nd, 2007 at 10:10 am
I checked and this will work on Windows as well. Though with Windows the file:// is optional.