[Tkabber-dev] r845 - in trunk/tkabber: . ifaceck plugins/chat plugins/general plugins/richtext

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Dec 26 17:10:23 MSK 2006


Author: sergei
Date: 2006-12-26 17:10:17 +0300 (Tue, 26 Dec 2006)
New Revision: 845

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/ckabber.tcl
   trunk/tkabber/custom.tcl
   trunk/tkabber/ifaceck/iroster.tcl
   trunk/tkabber/pixmaps.tcl
   trunk/tkabber/plugins/chat/logger.tcl
   trunk/tkabber/plugins/chat/nick_colors.tcl
   trunk/tkabber/plugins/general/headlines.tcl
   trunk/tkabber/plugins/general/message_archive.tcl
   trunk/tkabber/plugins/general/session.tcl
   trunk/tkabber/plugins/richtext/emoticons.tcl
   trunk/tkabber/roster.tcl
   trunk/tkabber/splash.tcl
   trunk/tkabber/tkabber.tcl
Log:
	* ckabber.tcl, custom.tcl, ifaceck/iroster.tcl, pixmaps.tcl,
	  plugins/chat/logger.tcl, plugins/chat/nick_colors.tcl,
	  plugins/general/headlines.tcl, plugins/general/message_archive.tcl,
	  plugins/general/session.tcl, plugins/richtext/emoticons.tcl,
	  roster.tcl splash.tcl tkabber.tcl: Introduced variable ::configdir,
	  which is set to normalized name of ~/.tkabber. This should help
	  with file operations in Windows.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/ChangeLog	2006-12-26 14:10:17 UTC (rev 845)
@@ -8,6 +8,14 @@
 
 	* plugins/chat/logger.tcl: Shortened filenames of log files.
 
+	* ckabber.tcl, custom.tcl, ifaceck/iroster.tcl, pixmaps.tcl,
+	  plugins/chat/logger.tcl, plugins/chat/nick_colors.tcl,
+	  plugins/general/headlines.tcl, plugins/general/message_archive.tcl,
+	  plugins/general/session.tcl, plugins/richtext/emoticons.tcl,
+	  roster.tcl splash.tcl tkabber.tcl: Introduced variable ::configdir,
+	  which is set to normalized name of ~/.tkabber. This should help
+	  with file operations in Windows.
+
 2006-12-25  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/general/session.tcl: Renamed session to state (only in

Modified: trunk/tkabber/ckabber.tcl
===================================================================
--- trunk/tkabber/ckabber.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/ckabber.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -14,6 +14,8 @@
     ::msgcat::mclocale $::env(LC_MESSAGES)
 }
 
+set configdir [file join ~ .tkabber]
+catch {set configdir [file normalize $configdir]}
 
 set version 0.9.7-alpha-20031223
 set toolkit_version "Tcl/Ck [info patchlevel]"
@@ -71,8 +73,8 @@
 hook::add postload_hook postload
 hook::add finload_hook finload
 
-if {[file exists ~/.tkabber/config.tcl]} {
-    source ~/.tkabber/config.tcl
+if {[file exists [file join $::configdir config.tcl]]} {
+    source [file join $::configdir config.tcl]
 }
 
 if {(![info exists load_default_xrdb] || $load_default_xrdb)} {
@@ -161,7 +163,7 @@
 
 #plugins::load [file join plugins general]
 #plugins::load [file join plugins $tcl_platform(platform)]
-#plugins::load_dir ~/.tkabber/plugins
+#plugins::load_dir [file join $::configdir plugins]
 
 load_source ifaceck iface.tcl
 

Modified: trunk/tkabber/custom.tcl
===================================================================
--- trunk/tkabber/custom.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/custom.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -5,7 +5,7 @@
 
 namespace eval custom {
     # Filename for saving options
-    set options(customfile) [file join ~ .tkabber custom.tcl]
+    set options(customfile) [file join $::configdir custom.tcl]
 
     # -1: stored values haven't been restored yet (only config changes vars)
     # 0: stored values are being restored now
@@ -513,7 +513,7 @@
 
     set args {}
     if {$tmp($varname) == ""} {
-	lappend args -initialdir ~/.tkabber/
+	lappend args -initialdir $::configdir
     } else {
 	lappend args -initialdir [file dirname $tmp($varname)] \
 	    -initialfile [file tail $tmp($varname)]
@@ -729,7 +729,7 @@
     }
 
     close $fd
-    catch {file attributes ~/.tkabber/custom.tcl -permissions 00600}
+    catch {file attributes [file join $::configdir custom.tcl] -permissions 00600}
 }
 
 proc custom::store_vars {args} {

Modified: trunk/tkabber/ifaceck/iroster.tcl
===================================================================
--- trunk/tkabber/ifaceck/iroster.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/ifaceck/iroster.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -1467,7 +1467,7 @@
     variable roster
 
     set filename [tk_getSaveFile \
-		      -initialdir ~/.tkabber/ \
+		      -initialdir $::configdir \
 		      -initialfile $::loginconf(user).roster \
 		      -filetypes [list \
 				      [list [::msgcat::mc "Roster Files"] \
@@ -1491,7 +1491,7 @@
     variable roster
 
     set filename [tk_getOpenFile \
-		      -initialdir ~/.tkabber/ \
+		      -initialdir $::configdir \
 		      -initialfile $::loginconf(user).roster \
 		      -filetypes [list \
 				      [list [::msgcat::mc "Roster Files"] \

Modified: trunk/tkabber/pixmaps.tcl
===================================================================
--- trunk/tkabber/pixmaps.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/pixmaps.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -51,7 +51,7 @@
 proc pixmaps::load_themes {} {
     set dirs [concat [glob -nocomplain -directory [fullpath pixmaps] *] \
 		     [glob -nocomplain \
-			  -directory [file join ~ .tkabber pixmaps] *]]
+			  -directory [file join $::configdir pixmaps] *]]
     foreach dir $dirs {
 	load_theme_name [namespace current]::themes $dir
     }

Modified: trunk/tkabber/plugins/chat/logger.tcl
===================================================================
--- trunk/tkabber/plugins/chat/logger.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/plugins/chat/logger.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -5,7 +5,7 @@
 namespace eval ::logger {
     custom::defgroup Logging [::msgcat::mc "Logging options."] -group Chat
 
-    custom::defvar options(logdir) [file join ~ .tkabber logs] \
+    custom::defvar options(logdir) [file join $::configdir logs] \
 	[::msgcat::mc "Directory to store logs."] \
 	-type string -group Logging
 

Modified: trunk/tkabber/plugins/chat/nick_colors.tcl
===================================================================
--- trunk/tkabber/plugins/chat/nick_colors.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/plugins/chat/nick_colors.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -72,7 +72,7 @@
 #
 proc nickcolors::load_nick_colors {} {
     variable NickColors
-    set filename [file join ~ .tkabber nickcolors.tcl]
+    set filename [file join $::configdir nickcolors.tcl]
     if {[file exists $filename]} {
         set f [open $filename r]
 	fconfigure $f -encoding utf-8
@@ -92,7 +92,7 @@
 # Called at shutdown to save the current set of nick-colors to file.
 proc nickcolors::save_nick_colors {} {
     variable NickColors
-    set filename [file join ~ .tkabber nickcolors.tcl]
+    set filename [file join $::configdir nickcolors.tcl]
     set f [open $filename w]
     fconfigure $f -encoding utf-8
     puts $f "# This is an automatically generated file. Do not edit."

Modified: trunk/tkabber/plugins/general/headlines.tcl
===================================================================
--- trunk/tkabber/plugins/general/headlines.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/plugins/general/headlines.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -662,7 +662,7 @@
         return
     }
 
-    if {[catch { open [set file1 [file join ~ .tkabber headlines1.tcl]] \
+    if {[catch { open [set file1 [file join $::configdir headlines1.tcl]] \
                       { WRONLY CREAT TRUNC } } fd]} {
         debugmsg headlines "unable to open $file: $fd"
         return
@@ -685,13 +685,13 @@
     }
 
     set renameP 0
-    if {![file exists [set file [file join ~ .tkabber headlines.tcl]]]} {
+    if {![file exists [set file [file join $::configdir headlines.tcl]]]} {
     } elseif {[file size $file] == 0} {
         catch { file delete -force $file }
     } else {
         set renameP 1
         catch { file rename -force $file \
-                     [set file0 [file join ~ .tkabber headlines0.tcl]] }
+                     [set file0 [file join $::configdir headlines0.tcl]] }
     }
 
     if {![catch { file rename $file1 $file } result]} {
@@ -733,7 +733,7 @@
     variable options
 
     if {$options(cache)} {
-	if {[file exists [set file [file join ~ .tkabber headlines.tcl]]]} {
+	if {[file exists [set file [file join $::configdir headlines.tcl]]]} {
 	    catch {
 		set fd [open $file "r"]
 		fconfigure $fd -encoding utf-8

Modified: trunk/tkabber/plugins/general/message_archive.tcl
===================================================================
--- trunk/tkabber/plugins/general/message_archive.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/plugins/general/message_archive.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -3,7 +3,7 @@
 option add *Messages.listheight 10 widgetDefault
 
 namespace eval ::message_archive {
-    variable logdir ~/.tkabber/logs
+    variable logdir [file join $::configdir logs]
 
     if {![file exists $logdir]} {
 	file mkdir $logdir

Modified: trunk/tkabber/plugins/general/session.tcl
===================================================================
--- trunk/tkabber/plugins/general/session.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/plugins/general/session.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -6,7 +6,7 @@
 #
 
 namespace eval session {
-    variable session_file [file join ~ .tkabber session.tcl]
+    variable session_file [file join $::configdir session.tcl]
 
     custom::defgroup State [::msgcat::mc "Tkabber save state options."] \
 	-group Tkabber

Modified: trunk/tkabber/plugins/richtext/emoticons.tcl
===================================================================
--- trunk/tkabber/plugins/richtext/emoticons.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/plugins/richtext/emoticons.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -489,7 +489,7 @@
 proc emoticons::enumerate_available_themes {} {
     set dirs [concat \
 		  [glob -nocomplain -directory [fullpath emoticons] *] \
-		  [glob -nocomplain -directory [file join ~ .tkabber emoticons] *]]
+		  [glob -nocomplain -directory [file join $::configdir emoticons] *]]
 
     foreach dir $dirs {
 	enumerate_theme [namespace current]::themes $dir

Modified: trunk/tkabber/roster.tcl
===================================================================
--- trunk/tkabber/roster.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/roster.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -656,7 +656,7 @@
     variable roster
 
     set filename [tk_getSaveFile \
-		      -initialdir ~/.tkabber/ \
+		      -initialdir $::configdir \
 		      -initialfile [jlib::connection_user $connid].roster \
 		      -filetypes [list \
 				      [list [::msgcat::mc "Roster Files"] \
@@ -680,7 +680,7 @@
     variable roster
 
     set filename [tk_getOpenFile \
-		      -initialdir ~/.tkabber/ \
+		      -initialdir $::configdir \
 		      -initialfile [jlib::connection_user $connid].roster \
 		      -filetypes [list \
 				      [list [::msgcat::mc "Roster Files"] \

Modified: trunk/tkabber/splash.tcl
===================================================================
--- trunk/tkabber/splash.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/splash.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -168,9 +168,9 @@
     if {([winfo exists .splash]) && ([llength $args] == 1)} {
 	set lrootdir [string tolower $rootdir]
 	set filepath [string tolower [lindex $args 0]]
-	set homedir [string tolower [file join ~ .tkabber]]
+	set homedir [string tolower $::configdir]
 	if {[catch { set globhomedir [file normalize $homedir] }]} {
-	    set plugins [lindex [glob -nocomplain [file join ~ .tkabber plugins]] 0]
+	    set plugins [lindex [glob -nocomplain [file join $homedir plugins]] 0]
 	    set globhomedir \
 		[file join [lrange [file split $plugins] 0 end-1]]
 	}

Modified: trunk/tkabber/tkabber.tcl
===================================================================
--- trunk/tkabber/tkabber.tcl	2006-12-26 13:08:08 UTC (rev 844)
+++ trunk/tkabber/tkabber.tcl	2006-12-26 14:10:17 UTC (rev 845)
@@ -60,6 +60,9 @@
     set rootdir [file dirname [info script]]
 }
 
+set configdir [file join ~ .tkabber]
+catch {set configdir [file normalize $configdir]}
+
 proc get_snapshot {changelog} {
     set snapshot ""
     if {[catch { open $changelog } fd]} {
@@ -135,8 +138,8 @@
     source $env(TKABBER_SITE_CONFIG)
 }
 
-if {[file exists [file join ~ .tkabber config.tcl]]} {
-    source [file join ~ .tkabber config.tcl]
+if {[file exists [file join $configdir config.tcl]]} {
+    source [file join $configdir config.tcl]
 }
 
 if {![info exists load_default_xrdb] || $load_default_xrdb} {
@@ -261,7 +264,7 @@
 	[file isdirectory $env(TKABBER_SITE_PLUGINS)]} {
     plugins::load_dir  $env(TKABBER_SITE_PLUGINS)
 }
-plugins::load_dir [file join ~ .tkabber plugins]
+plugins::load_dir [file join $configdir plugins]
 
 hook::run postload_hook
 



More information about the Tkabber-dev mailing list