Thread: PgcEdit v0.1
View Single Post
Old 17th June 2004, 11:01   #20  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Quote:
Originally posted by [Toff]
After putting some debug message, I've narrowed the guilty line :
Code:
# Full path is needed for FreeWrap
if {[info exists ::freewrap::progname]} {
	set config(apppath) "/Tcl/work/PGCEDIT"
	if {$::tcl_platform(platform) == "windows"} {
		# !!! IT HANG HERE, ON NEXT LINE !!! <-----------X
		source $config(apppath)/lib/winshellext.tcl
	}
} else {
	set config(apppath) "[file dirname $argv0]"
}
This is when started from wish manually.
I'm not sure to understand you. Do you mean that the "source ..." line is executed when you launch PgcEdit.tcl from wish? It's absolutely abnormal!

The winshellext.tcl file is needed only for the Install menu, which is present only in freeWrapped PgcEdit.exe, because it uses stuff provided by freeWrap but not by Wish.

The first IF line is my way to test if PgcEdit is run as a freeWrapped app or from Wish. Indeed, ::freewrap::progname is a variable automatically created by FreeWrap before it initialize the app. This variable may not exists if PgcEdit is run from Wish, and the IF test must therefore bypass the whole section. If it doesn't, it's really a strange behavior.


Quote:
EDIT : In fact this last problem is only when i use freewrap as a wish interpreter, using the interpreter from ActiveTcl it works if I make the pgcedit directory the current directory first.
I was editing the PgcEdit code when I see your edit. You're rigth. I need to test if the program is launched interactively, and, in that case, use another way to find the source directory of PgcEdit. Unfortunately, I can't find a practical way to do that. I can however inform the user of the problem and return gracefully. Here is the code section that does just that:
Code:
# Full path is needed for FreeWrap
if {$tcl_interactive} {
	set config(apppath) [pwd]
	if {! [file exists $config(apppath)/lib/main.tcl]} {
		puts "Please CD to the PgcEdit directory before launching it."
		return 1
	}
} else {
	if {[info exists ::freewrap::progname]} {
		set config(apppath) "/Tcl/work/PGCEDIT"
		if {$::tcl_platform(platform) == "windows"} {
			source $config(apppath)/lib/winshellext.tcl
		}
	} else {
		set config(apppath) "[file dirname $argv0]"
	}
}
But I'm affraid this patch will not fix the first problem you had when PgcEdit is used as a freeWrapped executable.

Last chance try:
Be sure to associate the .TCL files with WishRun.exe, then launch the original PgcEdit by clicking on PgcEdit.tcl. I will be interested in knowing what is happening in this precise case.
Then edit PgcEdit.tcl with the code above, and try again. This must work.
Hint: you may add a "console show" line to open the console.

It may be usefull also to check the original PgcEdit.exe on another computer running Win2K. Is it possible for you?
r0lZ is offline   Reply With Quote