[GRASS-SVN] r38295 - grass/branches/develbranch_6/lib/gtcltk

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 7 10:44:49 EDT 2009


Author: marisn
Date: 2009-07-07 10:44:48 -0400 (Tue, 07 Jul 2009)
New Revision: 38295

Modified:
   grass/branches/develbranch_6/lib/gtcltk/gronsole.tcl
   grass/branches/develbranch_6/lib/gtcltk/select.tcl
Log:
Fix TCL/Tk map selection window file name portability. Fixes #593

Modified: grass/branches/develbranch_6/lib/gtcltk/gronsole.tcl
===================================================================
--- grass/branches/develbranch_6/lib/gtcltk/gronsole.tcl	2009-07-07 13:33:54 UTC (rev 38294)
+++ grass/branches/develbranch_6/lib/gtcltk/gronsole.tcl	2009-07-07 14:44:48 UTC (rev 38295)
@@ -468,7 +468,7 @@
 	# Actually run the program
 	# |& grocat merges stdout and stderr because Tcl treats
 	# anything written to stderr as an error condition
-	set cmd [concat | $cmd |& $env(GISBASE)/etc/grocat]
+	set cmd [concat | $cmd |& [file join "$env(GISBASE)" "etc" "grocat"]]
 
 	set message_env [exec g.gisenv get=GRASS_MESSAGE_FORMAT]
         set env(GRASS_MESSAGE_FORMAT) gui

Modified: grass/branches/develbranch_6/lib/gtcltk/select.tcl
===================================================================
--- grass/branches/develbranch_6/lib/gtcltk/select.tcl	2009-07-07 13:33:54 UTC (rev 38294)
+++ grass/branches/develbranch_6/lib/gtcltk/select.tcl	2009-07-07 14:44:48 UTC (rev 38295)
@@ -160,24 +160,24 @@
     	$tree bindText  <Control-ButtonPress-1> "GSelect_::select $id $tree"
     }
     
-    set location_path "$env(GISDBASE)/$env(LOCATION_NAME)/"
-    set current_mapset "$env(MAPSET)"
-    set sympath "$env(GISBASE)/etc/symbol/"
+    set location_path [file normalize [file join "$env(GISDBASE)" "$env(LOCATION_NAME)"]]
+    set current_mapset [file normalize "$env(MAPSET)"]
+    set sympath [file normalize [file join "$env(GISBASE)" "etc" "symbol"]]
     
     # main selection subroutine
     if {$element != "symbol"} {
         foreach dir [exec g.mapsets -p] {
-            set windfile "$location_path/$dir/WIND"
+            set windfile [file normalize [file join "$location_path" "$dir" "WIND"]]
             if { ! [ file exists $windfile ] } { continue }
-            if { $dir == $current_mapset } {
+            if { $dir == [file tail "$current_mapset"] } {
                 $tree insert end root ms_$dir -text $dir -data $dir -open 1 \
                     -image [Bitmap::get openfold] -drawcross auto
             } else {
                 $tree insert end root ms_$dir -text $dir -data $dir -open 0 \
                     -image [Bitmap::get folder] -drawcross auto
             }
-            set path "$location_path/$dir/$element/"
-            foreach fp [ lsort -dictionary [glob -nocomplain $path/*] ]  {
+            set path [file normalize [file join "$location_path" "$dir" "$element"]]
+            foreach fp [ lsort -dictionary [glob -nocomplain -directory $path *] ]  {
                 set file [file tail $fp]
                 $tree insert end ms_$dir $file@$dir -text $file -data $file \
                     -image [Bitmap::get file] -drawcross never
@@ -190,14 +190,14 @@
         $tree insert end root ms_$sympath -text SYMBOLS -data $sympath -open 1 \
             -image [Bitmap::get openfold] -drawcross auto
         
-        foreach ic_dir [ lsort -dictionary [glob -nocomplain $sympath/*] ]  {
+        foreach ic_dir [ lsort -dictionary [glob -nocomplain -directory $sympath *] ]  {
             set dir_tail [file tail $ic_dir]
             $tree insert end ms_$sympath ms_$dir_tail  -text $dir_tail -data $dir_tail \
                 -image [Bitmap::get folder] -drawcross auto
     
-            foreach ic_file [ lsort -dictionary [glob -nocomplain $sympath/$dir_tail/*] ]  {
+            foreach ic_file [ lsort -dictionary [glob -nocomplain -directory [file join "$sympath" "$dir_tail"] *] ]  {
                 set file [file tail $ic_file]
-                $tree insert end ms_$dir_tail $dir_tail/$file -text $file -data $file \
+                $tree insert end ms_$dir_tail [file join "$dir_tail" "$file"] -text $file -data $file \
                     -image [Bitmap::get file] -drawcross never
             }
         }



More information about the grass-commit mailing list