Hi;
Im wondering if someone might be able to advise me of the 'right' way to solve an issue Im having with PD 0.43.1 extended on Win7 x64.
By default, when PD starts I get the following error reported in the main window
(Tcl) UNHANDLED ERROR: couldn't read directory "C:/Users/sxa/Application Data/*-plugin": permission denied
while executing
"glob -directory $dir -nocomplain -types {f} -- *-plugin/*-plugin.tcl *-plugin.tcl"
(procedure "load_startup_plugins" line 7)
invoked from within
"load_startup_plugins"
(procedure "pdtk_pd_startup" line 20)
invoked from within
"pdtk_pd_startup 0 43 1 {extended-20120423} { {"standard (MMIO)" 3} {"ASIO (via portaudio)" 4} } {} {DejaVu Sans Mono} normal"
("uplevel" body line 53)
invoked from within
"uplevel #0 $cmds_from_pd"Using C:/Program Files (x86)/pd/startup as startup.
Now, I know very little about PD and have only a passing familiarity with TCL, but it seemed to me that PD shouldnt be looking for plugins in
C:/Users/sxa/Application Data/
it should be looking for them in
C:/Users/sxa/Application Data/Pd
Because Im on Win7
C:/Users/sxa/Application Data/Pd
maps to
C:\Users\sean\AppData\Roaming\Pd
but Ive made sure that exists, so that's not the issue.
So I did a little bit of grepping through the source code and found the relevant section of code starting at line 674 of pd-gui.tcl
proc load_startup_plugins {} {
foreach pathdir [concat $::sys_searchpath $::sys_staticpath] {
set dir [file normalize $pathdir]
if { ! [file isdirectory $dir]} {continue}
foreach filename [glob -directory $dir -nocomplain -types {f} -- \
*-plugin/*-plugin.tcl *-plugin.tcl] {
set ::current_plugin_loadpath [file dirname $filename]
load_plugin_script $filename
}
}
}
I was able to figure out how to add some debug lines to that changing it to
proc load_startup_plugins {} {
foreach pathdir [concat $::sys_searchpath $::sys_staticpath] {
::pdwindow::debug "pathdir: $pathdir\n"
set dir [file normalize $pathdir]
if { ! [file isdirectory $dir]} {continue}
::pdwindow::debug "dir: $dir\n"
foreach filename [glob -directory $dir -nocomplain -types {f} -- \
*-plugin/*-plugin.tcl *-plugin.tcl] {
::pdwindow::debug "filename: $filename\n"
set ::current_plugin_loadpath [file dirname $filename]
load_plugin_script $filename
}
}
}
and this is the result of the debug log output I got:
pathdir: U:/Documents/PD
dir: U:/Documents/PD
pathdir: C:/Program Files (x86)/Common Files/Pd
pathdir: C:/Users/sean/Application Data/Pd
dir: C:/Users/sean/Application Data/
So it seemed to me that the line
set dir [file normalize $pathdir]
is actually stripping the lowest subdirectory (PD) off the path.
To confirm that, I kludged the fileglob as so
foreach filename [glob -directory $dir -nocomplain -types {f} -- \
Pd/*-plugin/*-plugin.tcl Pd/*-plugin.tcl] {
And my UNHANDLED ERROR finally disappeared.
Obviously I dont want to leave the kludge in there, but what's the right thing to do?
Should I be looking deeper into what normalize is doing to $pathdir?
Any advice gratefully received.