2

Try to open a file with gvim.exe in tcl. I have correctly installed gvim but cannot open it with the following 2 command:

exec gvim.exe $file_path
exec ./gvim.exe $file_path

However, is able to open the file with the following 2 commands:

exec notepad.exe $file_path
exec "C:/Program Files/vim/vim74/gvim.exe

Could somebody tell me what happened and what I should do here?

tshepang
  • 12,111
  • 21
  • 91
  • 136
user2895478
  • 383
  • 4
  • 15

1 Answers1

2

When Tcl execs a program, it searches for the program on your PATH (i.e., $::env(PATH)) using the OS's normal rules. Programs not on the PATH (and not in the current directory on Windows) are simply not found.

Fix 1

Update your PATH; I believe you can do this through the Control Panel on a per-user basis, or for all users (with appropriate permissions).

Fix 2

Update the PATH in your script. Be aware that the Windows path separator is a command separator in Tcl (i.e., needs to be escaped or come from substitution) and the elements in the PATH need to be native directory names.

append ::env(PATH) $::tcl_platform(pathSeparator) \
        [file nativename "C:/Program Files/vim/vim74"]

## This will do the same thing...
# append ::env(PATH) {;C:\Program Files\vim\vim74}
Donal Fellows
  • 133,037
  • 18
  • 149
  • 215