Open file with system's default program

Is there a cross platform way to open a file with the system’s default program, basically simulating a double click on the file’s icon?
More specifically, the type of files that will get opened this way is a video file. Instead of building all the GUI involved in making a good video player, I’d let the local system take care of it with whatever solution the user prefers. This way, if the video file can play on their machine, it’ll “play in” my program.

1 Like

No.

OK…
So nothing like matlab’s winopen (just found it now).

Hmmm…

OO, no idea if this will work, but maybe something like this:

function openit(f::String)
    if is_windows()
        run(`start $f`)
    elseif is_linux()
        run(`xdg-open $f`)
    elseif is_apple()
        run(`open $f`)
    else
        error("Couldn't open $f")
    end
end

5 Likes

Meanwhile there is a package for this.

Default Application

Replying to this old post because I had trouble finding the package.

2 Likes