Revision: 10643 http://pure-data.svn.sourceforge.net/pure-data/?rev=10643&view=rev Author: eighthave Date: 2009-01-26 04:02:19 +0000 (Mon, 26 Jan 2009)
Log Message: ----------- - added -- to regsubs to make them more fault tolerant
- added -nocase to file extension regexps to get extensions with non-lower case
- for the open/save panels, test if the dir exists, otherwise using $HOME, in case the dir has been moved or renamed since the last open/save
Modified Paths: -------------- branches/pd-extended/0.41/pd/src/u_main.tk
Modified: branches/pd-extended/0.41/pd/src/u_main.tk =================================================================== --- branches/pd-extended/0.41/pd/src/u_main.tk 2009-01-26 01:03:40 UTC (rev 10642) +++ branches/pd-extended/0.41/pd/src/u_main.tk 2009-01-26 04:02:19 UTC (rev 10643) @@ -493,6 +493,7 @@ proc menu_new {} { global untitled_number global untitled_directory + if { ! [file isdirectory $untitled_directory]} {set untitled_directory $::env(HOME)} pd [concat pd filename Untitled-$untitled_number \ [pdtk_enquote $untitled_directory] ;] pd { @@ -506,6 +507,7 @@
proc menu_open {} { global pd_opendir filetypes + if { ! [file isdirectory $pd_opendir]} {set pd_opendir $::env(HOME)} set files [tk_getOpenFile -defaultextension .pd \ -multiple true \ -filetypes $filetypes -initialdir $pd_opendir] @@ -518,11 +520,11 @@
proc open_file {filename} { global pd_opendir - set directory [string range $filename 0 [expr [string last / $filename] - 1]] - set pd_opendir $directory - set basename [string range $filename [expr [string last / $filename] + 1] end] + set directory [file dirname $filename] + set basename [file tail $filename] if {[regexp -nocase -- ".(pd|pat|mxt)$" $filename]} { pd "pd open [pdtk_enquote $basename] [pdtk_enquote $directory] ;" + set pd_opendir $directory } }
@@ -652,7 +654,7 @@ proc menu_openpdpedia {} { set top_window [lindex [wm stackorder .] end] set window_title [wm title $top_window] - set helpfile [regsub {(.*)-help.*} $window_title {\1}] + set helpfile [regsub -- {(.*)-help.*} $window_title {\1}] if {$helpfile eq $window_title} { menu_openhtml "http://wiki.puredata.info/" } else { @@ -665,9 +667,9 @@
set dirname $pd_guidir/$subdir
- if {[regexp ".*.(txt|c)$" $basename]} { + if {[regexp -nocase -- ".*.(txt|c)$" $basename]} { menu_opentext $dirname/$basename - } elseif {[regexp ".*.html?$" $basename]} { + } elseif {[regexp -nocase -- ".*.html?$" $basename]} { menu_openhtml $dirname/$basename } else { pd [concat pd open [pdtk_enquote $basename] \ @@ -2218,6 +2220,7 @@
proc pdtk_canvas_saveas {name initfile initdir} { global pd_nt filetypes untitled_directory + if { ! [file isdirectory $initdir]} {set initdir $::env(HOME)} set filename [tk_getSaveFile -initialfile $initfile -initialdir $initdir \ -defaultextension .pd -filetypes $filetypes]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.