[PD-dev] Tcl exec vs. Microsoft filenames
Hans-Christoph Steiner
hans at eds.org
Tue Jan 24 05:29:36 CET 2006
On Jan 23, 2006, at 4:36 PM, Martin Peach wrote:
> Martin Peach wrote:
>
>> Hans-Christoph Steiner wrote:
>>
>>>
>>>
>>> I think its more of a Tcl question. The problem is that if I run
>>> this from the command line, it works fine:
>>>
>>> rundll32 url.dll,FileProtocolHandler file:C:/Program
>>> Files/pd/doc/manuals/Gem/cMatrix.html
>>>
>>> But if I do this in Tcl, it does not:
>>>
>>> set filename "C:/Program Files/pd/doc/manuals/Gem/cMatrix.html"
>>> exec rundll32 url.dll,FileProtocolHandler [format "file:%s"
>>> $filename] &
>>>
>>> Quotes don't seem to make it work either.
>>>
>>
>> I tried the following simple script on WinXP and it works fine here
>> (Tcl for Windows Tcl 8.4.11, Tk 8.4.11) using File->Source... from
>> the Console that shows up when you type "wish" on a command line:
>>
>> #!/usr/bin/wish
>>
>> puts "Hello"
>> set filename "C:/Program Files/pd/doc/gem/manual/index.html"
>> exec rundll32 url.dll,FileProtocolHandler [format "file:%s"
>> $filename] &
>>
>> ... then my browser opens the URL
>> "file:///C:/Program%20Files/pd/doc/gem/manual/index.html".
>> It also works if I just enter the name of the script in a command
>> prompt window.
>
>
> Further testing shows that while a path like "C:/Program
> Files/pd/doc/gem/manual/index.html" is processed correctly, in pd.tk
> the actual path is something like "C:/Program
> Files/pd/bin/../doc/gem/manual/index.html" and this kind of path
> doesn't work if there are spaces. I would think this is a bug in
> tcl/tk and not pd, but it might be more elegant to make the help
> pathnames by stripping the "bin" from pd_guidir instead of appending
> "..".
I am not sure that the Pd.app path ends in "bin", it might end in
"MacOS". the [file attributes $filename -shortname] hack works fine,
for now at least. Feel free to submit a cleaner version.
.hc
________________________________________________________________________
____
http://at.or.at/hans/
More information about the Pd-dev
mailing list