From 508b7b1123ea479caed7af68ffd9f90ffcc37281 Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 25 Sep 2012 23:14:49 +0100 Subject: Stop using dirty and dangerous PATH hack --- Makefile | 20 +++++++++++--------- TODO | 1 - getxbookgui.tcl | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 51b25cb..b123b11 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,8 @@ dist: # needs config.mk set up to build statically dist-static: $(BIN) mkdir -p $(NAME)-$(VERSION) - cp $(BIN) $(GUI) $(DOC) $(MAN) config.mk $(NAME)-$(VERSION) + sed '/^\tset cmd / i set cmdbin [file join ./ $$cmdbin]' < getxbookgui.tcl > $(NAME)-$(VERSION)/getxbookgui.tcl + cp $(BIN) $(DOC) $(MAN) config.mk $(NAME)-$(VERSION) sed 's/^install: all$$/install:/' < Makefile > $(NAME)-$(VERSION)/Makefile mkdir -p $(NAME)-$(VERSION)/icons cp icons/* $(NAME)-$(VERSION)/icons/ @@ -76,14 +77,15 @@ dist-static: $(BIN) echo $(NAME)-$(VERSION)-static.tar.bz2 $(NAME)-$(VERSION)-static.tar.bz2.sig getxbookgui.exe: getxbookgui.tcl - @echo STARPACK $@ - @sed 's/\/icons/\/..\/icons/;s/set cmd "/set cmd "tools\//' < getxbookgui.tcl > getxbookgui-win.tcl - @sdx qwrap getxbookgui-win.tcl getxbookgui - @sdx unwrap getxbookgui.kit - @cp -f getxbook.ico getxbookgui.vfs/tclkit.ico - @echo 'FileDescription "Book downloader"' > getxbookgui.vfs/tclkit.inf - @sdx wrap $@ -runtime $(W32TCLKIT) - @rm -r getxbookgui-win.tcl getxbookgui.kit getxbookgui.vfs + echo STARPACK $@ + sed 's/ icons/ .. icons/' < getxbookgui.tcl > getxbookgui-win.tcl + sed -i '/^\tset cmd / i set cmdbin [file join tools $$cmdbin]' getxbookgui-win.tcl + sdx qwrap getxbookgui-win.tcl getxbookgui + sdx unwrap getxbookgui.kit + cp -f getxbook.ico getxbookgui.vfs/tclkit.ico + echo 'FileDescription "Book downloader"' > getxbookgui.vfs/tclkit.inf + sdx wrap $@ -runtime $(W32TCLKIT) + rm -r getxbookgui-win.tcl getxbookgui.kit getxbookgui.vfs # needs config.mk set up to use mingw dist-win: $(BIN) $(GUI:.tcl=.exe) diff --git a/TODO b/TODO index c1a57b2..2eb2e66 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -use a better method than setting PATH in gui release 1.1 create debian package & post to mentors list check whether windows build will still run the tools successfully if run from a shortcut elsewhere diff --git a/getxbookgui.tcl b/getxbookgui.tcl index eb3c863..2cc9b96 100755 --- a/getxbookgui.tcl +++ b/getxbookgui.tcl @@ -12,7 +12,6 @@ set cmdselected 0 set dling 0 set manual 0 -set env(PATH) "[file dirname $::argv0]:$env(PATH)" set iconpath [file join [file dirname $::argv0] icons] proc updateStatus {chan} { @@ -46,7 +45,8 @@ proc go {} { if { [.input.id get] == "" } { return } - set cmd "[lindex [lindex $cmds $cmdselected] 0] [.input.id get]" + set cmdbin [lindex [lindex $cmds $cmdselected] 0] + set cmd "$cmdbin [.input.id get]" set dling 1 .dl configure -state disabled -text "Downloading" .input.id configure -state readonly -- cgit v1.2.3