Re: Execute associated image viewer or media player on button click




On Tue, Dec 8, 2009 at 3:38 PM, Dov Grobgeld <dov grobgeld gmail com> wrote:

You don't say under what system you need this.

My apologies, potentially I would like it to work on both windows and linux.


On windows you would simply do:

   system("foo.png")

and you would call the viewer associated with .png files.

(This works for url's as well as just running it through system, runs the prefered user browser).


Thanks for this.

On Linux there is no such system default, but the specifics depend on your desktop.

In linux you can do:
xdg-open file
or
gnome-open file


And thanks for the linux information.  

Is xdg-open file the best way to go rather than checking whether or not the user is using KDE/Gnome?  Just 
out of interest is there a way to confirm which desktop they are using?  Some clever variable like the $^O 
one for checking the OS?



      __________________________________________________________________________________
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]