[PD-dev] [ pure-data-Patches-1412210 ] fix for bug in menu_openhtml on Windows

SourceForge.net noreply at sourceforge.net
Sat Jan 2 02:58:13 CET 2010


Patches item #1412210, was opened at 2006-01-22 13:26
Message generated for change (Settings changed) made by eighthave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1412210&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Out of Date
Priority: 8
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: Miller Puckette (millerpuckette)
Summary: fix for bug in menu_openhtml on Windows

Initial Comment:

menu_openhtml() currently does not work if there is a
space in the file/path name (i.e. "C:\Program Files\pd")


Here is a fix.  In menu_openhtml() in u_main.tk, change:

exec rundll32 url.dll.FileProtocolHandler \
	[format "file:%s" $filename] &

To this:

exec rundll32 url.dll.FileProtocolHandler \
	[format "file:%s" [file attributes $filename
-shortname]] &


----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2010-01-01 20:58

Message:
This patch has either been incorporated into pd-gui-rewrite pd-devel 0.43
or made irrelevant by it.

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2006-01-28 22:06

Message:
Logged In: YES 
user_id=27104

This is a better method of fixing this that Martin Peach
posted.  (I haven't tested it yet)  .hc


In u_main.tk the procedure menu_openhtml fails on the
NT platform when pd_guidir contains both spaces and the
double dot (/..) which is currently always added for NT
when pd_guidir is constructed from e.g. "C:/Program
Files/pd/bin" as "C:/Program Files/pd/bin/.." instead
of the more straightforward "C:/Program Files/pd".

Forcing the use of short filenames is one way around
this but the attached patch just strips off the "/bin"
instead of adding "/.." to it.

This line terminates the path just before the last slash:

set pd_guidir [string range $pd_guidir 0 [expr [string
last / $pd_guidir] - 1]]

It also might be more efficient to work only with
pd_guidir, since it always gets shortened, so I took
out the temporary string pd_gui3 as well.

Martin Peach

martinrp at vax2.concordia.ca

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2006-01-25 12:53

Message:
Logged In: NO 

The bug seems to be happen only when the path has spaces
_and_  the double dot .. in it.
It might be better to make guidir a straight path instead.
In this part of pd.tk:

if {$pd_nt == 1} {
    global pd_guidir
    global pd_tearoff
    set pd_gui2 [string range $argv0 0 [expr [string last \\
$argv0 ] - 1]]
    regsub -all \\\\ $pd_gui2 / pd_gui3
    set pd_guidir $pd_gui3/..
    load $pd_guidir/bin/pdtcl.dll
    set pd_tearoff 1
}
Change to:

if {$pd_nt == 1} {
    global pd_guidir
    global pd_tearoff
    set pd_gui2 [string range $argv0 0 [expr [string last \\
$argv0 ] - 1]]
    regsub -all \\\\ $pd_gui2 / pd_gui3
    set pd_gui4 [string range $pd_gui3 0 [expr [string last
/ $pd_gui3] - 1]]
    set pd_guidir $pd_gui4
    load $pd_guidir/bin/pdtcl.dll
    set pd_tearoff 1
}
This has the effect:

argv0: C:\Copy of pd_039_0_test7\pd\bin\pd.tk
pd_guidir: C:/Copy of pd_039_0_test7/pd
(instead of C:/Copy of pd_039_0_test7/pd/bin/..)
pd_gui2: C:\Copy of pd_039_0_test7\pd\bin
pd_gui3: C:/Copy of pd_039_0_test7/pd/bin
menu_openhtml filename: C:/Copy of
pd_039_0_test7/pd/doc/1.manual/index.htm

(Lines are too short on this comment box:( )
Martin
martinrp at vax2.concordia.ca

----------------------------------------------------------------------

Comment By: Hans-Christoph Steiner (eighthave)
Date: 2006-01-22 13:27

Message:
Logged In: YES 
user_id=27104

oops, "-shortname]] &" should be on the same line as the
line above.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1412210&group_id=55736




More information about the Pd-dev mailing list