{"id":156,"date":"2007-07-23T17:00:04","date_gmt":"2007-07-24T00:00:04","guid":{"rendered":"http:\/\/www.stevenbrown.ca\/blog\/archives\/156"},"modified":"2007-11-23T02:39:49","modified_gmt":"2007-11-23T09:39:49","slug":"how-to-open-a-folder-with-the-default-file-manager-in-monoc","status":"publish","type":"post","link":"https:\/\/www.stevenbrown.ca\/blog\/archives\/156","title":{"rendered":"How to open a folder with the default file-manager in mono\/C#"},"content":{"rendered":"<div class=\"codeblock\">\nusing System.Diagnostics;<\/p>\n<p>&#8230;<\/p>\n<p>Process.Start (&#8220;file:\/\/\/home\/&#8221;);\n<\/p><\/div>\n<p>Did a bit of IRC channel ping-pong today.  Went over to <a href=\"irc:\/\/irc.gnome.org\/#f-spot\">#f-spot<\/a> to ask a <a href=\"http:\/\/bugzilla.gnome.org\/show_bug.cgi?id=459671\">user-related question<\/a> about <a href=\"http:\/\/f-spot.org\/Main_Page\">f-spot<\/a>, and got pulled in by curiosity on a totally unrelated topic: <em>opening a folder with the default file-manager<\/em>.  Initiated some discussion on <a href=\"irc:\/\/irc.gnome.org\/#mono\">#mono<\/a> and discovered this was, in fact, <a href=\"http:\/\/cweiske.de\/howto\/launch\/allinone.html\">not trivial<\/a> &#8211; which seemed odd.  But I&#8217;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.<\/p>\n<p>(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 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Miguel_de_Icaza\">the man<\/a>, himself! &#8211; He claims his memory is fading&#8230;), so I figure it&#8217;s worth documenting.  More info can be seen <a href=\"http:\/\/www.go-mono.com\/archive\/1.2.1\/\">here<\/a> under <em>Process<\/em>.<\/p>\n<blockquote><p>\nOn FreeDesktop systems it will use xdg-open, if not, it will try to use gnome-open or kfmclient to open the files.\n<\/p><\/blockquote>\n<p>Not sure if this will work on Windows.  The <code>file:\/\/<\/code> prefix is required.<\/p>\n<p><strong>Update:<\/strong> According to <a href=\"https:\/\/www.stevenbrown.ca\/blog\/archives\/156#comment-48796\">ccoish<\/a>, this <em>will<\/em> work on Windows.<\/p>\n<p>Passing this info back to #f-spot resulted in a <a href=\"http:\/\/bugzilla.gnome.org\/show_bug.cgi?id=459748\">patch<\/a> to allow you to open the folder containing your photo.  Thanks, Gabriel!  Open source is cool.  \ud83d\ude42<\/p>\n<p>Not sure if I&#8217;ll look at C#\/Mono much more, was kinda gonna do the Python thing for a while&#8230; but this was a fun distraction.  \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>using System.Diagnostics; &#8230; Process.Start (&#8220;file:\/\/\/home\/&#8221;); 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&hellip; <a class=\"more-link\" href=\"https:\/\/www.stevenbrown.ca\/blog\/archives\/156\">Continue reading <span class=\"screen-reader-text\">How to open a folder with the default file-manager in mono\/C#<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3,11],"tags":[63,48,12,10,42,4,62,66],"class_list":["post-156","post","type-post","status-publish","format-standard","hentry","category-geek","category-projects","tag-c","tag-code","tag-floss","tag-gnome","tag-how-to","tag-linux","tag-mono","tag-programming","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4jEMb-2w","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts\/156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":0,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}