Help with trivial test on OS X and Windows

Various libraries have a snippet for opening files in external programs using xgd-open (Linux), open (OS X), and cmd.exe (Windows), which are frequently sources of issues which are hard to replicate and track down. I thought this could be centralized in a single package, so I wrote

I tested on Linux, but I need help from testers on Windows and OS X. If you have a minute and you are already using v0.7, please help out by running

pkg> add https://github.com/tpapp/DefaultApplication.jl
julia> import DefaultApplication
julia> DefaultApplication.test()

which should open a text file.

1 Like

What I use on Windows for that purpose is explorer, not cmd. Basically I do

	if (Sys.iswindows()) run(ignorestatus(`explorer $out`))
	elseif (is_apple()) run(`open $(out)`)
	elseif (is_linux()) run(`xdg-open $(out)`)

where out is the file name.

… and this just made me realized that my pert to 0.7 is incomplete and works only on Windows

Hi Tamas,

Works fine on OSX:

julia> import DefaultApplication

julia> DefaultApplication.test()
β”Œ Info: opening text file with the default application
β”” path = β€œ/var/folders/fb/m164mwfn3v1btnrpmmyzpvqh0000gn/T/juliaXPmD7d.txt”
β”Œ Info: If the file was not opened, please copy the output and open an issue at
β”‚ Issues Β· tpapp/DefaultApplication.jl Β· GitHub
β”‚ KERNEL = :Darwin
β”” VERSION = v"0.7.0-beta2.15"
Process(open /var/folders/fb/m164mwfn3v1btnrpmmyzpvqh0000gn/T/juliaXPmD7d.txt, ProcessExited(0))

and TextEdit appears.

julia> versioninfo()
Julia Version 0.7.0-beta2.15
Commit 199b74e853* (2018-07-16 12:23 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin17.7.0)
CPU: Intel(R) Coreβ„’ i5-6267U CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
Environment:
JULIA_PKG3_PRECOMPILE = true
JULIA_EDITOR = see
JULIA_SVG_BROWSER = Google Chrome.app

1 Like

Worked in Windows 10. It opened notepad

julia> import DefaultApplication

julia> DefaultApplication.test()
β”Œ Info: opening text file with the default application
β””   path = "C:\\Users\\username\\AppData\\Local\\Temp\\1\\jl_483D.tmp.txt"
β”Œ Info: If the file was not opened, please copy the output and open an issue at
β”‚ https://github.com/tpapp/DefaultApplication.jl/issues
β”‚   KERNEL = :NT
β””   VERSION = v"0.7.0-beta2.0"
β”Œ Info: Version information for windows
β””   windows_version = v"10.0.16299"
Process(`'C:\WINDOWS\system32\cmd.exe' /c start 'C:\Users\username\AppData\Local\Temp\1\jl_483D.tmp.txt'`, ProcessExited(0))

version details:

julia> versioninfo()
Julia Version 0.7.0-beta2.0
Commit b145832402* (2018-07-13 19:54 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
1 Like

Looks great, and does everything it should β€” on macOS.

Out of interest, is the message:

Process(`open /tmp/mdtable.md`, ProcessExited(0))

controllable via the DefaultApplication.open() function? I quite fancy not seeing it by default (I think it’s a new thing in v0.7…)

Perhaps I’ll switch to using DefaultApplication.jl soon…

On Windows 10
julia> versioninfo()
Julia Version 0.7.0-beta2.0
Commit b145832402* (2018-07-13 19:54 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)

Opens a Notepad window

1 Like

It is not a message, but a return value.

Normally DefaultApplication.open would be called by a function, so you would not see it.

EDIT: my bad, it was the pasted expression that caused the error. The notepad opened okay.

julia> julia> DefaultApplication.test()
β”Œ Info: opening text file with the default application
β””   path = "C:\\Users\\PETRKR~1\\AppData\\Local\\Temp\\jl_A44.tmp.txt"
β”Œ Info: If the file was not opened, please copy the output and open an issue at
β”‚ https://github.com/tpapp/DefaultApplication.jl/issues
β”‚   KERNEL = :NT
β””   VERSION = v"0.7.0-beta2.12"
β”Œ Info: Version information for windows
β””   windows_version = v"10.0.17134"
ERROR: UndefVarError: julia not defined
Stacktrace:
 [1] top-level scope at none:0

I changed the default application for .txt files to be VS code: it worked beautifully.

Thanks for this very useful package!

1 Like

I would like to thank everyone who helped with testing. The package is now registered.

1 Like