Tk Library Source Code

Artifact [8015d44950]
Login

Artifact 8015d44950e5f47226b1038fedf63257b6a5ebb1:

Attachment "ico-vfs.diff" to ticket [1398330fff] added by a_kovalenko 2006-01-06 14:40:56.
--- ico.tcl.orig	2005-08-14 14:59:51.000000000 +0400
+++ ico.tcl	2006-01-06 10:24:30.000000000 +0300
@@ -872,12 +872,15 @@
 	set fh [open $file w+]
 	fconfigure $fh -eofchar {} -encoding binary -translation lf
 	bputs $fh sss 0 1 0
-	seek $fh 0 start
+	seek $fh 4 start
+	set is_new 1
     } else {
 	set fh [open $file r+]
 	fconfigure $fh -eofchar {} -encoding binary -translation lf
+	set is_new 0
     }
-    if {[file size $file] > 4 && "[getword $fh] [getword $fh]" ne "0 1"} {
+    if {!$is_new && [file size $file] > 4 && 
+	"[getword $fh] [getword $fh]" ne "0 1"} {
 	close $fh
 	return -code error "not an icon file"
     }