TclApp not wrapping files correctly?

Posted by vpetrovic on 2014-06-17 06:28
Forums: TDK discussion | OS: Windows 7

Hello fellow TDK users!

I'm having a difficult time wrapping a program of mine with TclApp - basically when I do so, my program is not able to find any of the files I source from it. As I understand from the official description:

" Tcl Dev Kit's TclApp can greatly simplify the process of distributing an application that you write in Tcl. TclApp is a tool that collects all of the files needed to run a Tcl application--such as Tcl scripts, graphics and other data files, Tcl extensions, a Tcl interpreter, and the standard Tcl and Tk libraries--into a single executable file. A user can then install this file anywhere on their system and execute it without installing any other packages or otherwise configuring their system."

TclApp is supposed to wrap my program and all the files I specify with it such that it can run anywhere without trouble. I understand that TclApp uses a virtual file system and it creates sub-directories under the .exe like myProgram.exe/lib/application/...

The problem is when I wrap my program with TclApp, it's not able to find any of the files whatsoever - I have to actually go in the Tcl code and specify a full path for some of them to get my program to even run, and then even so the program still refuses to run unless the executable is placed specifically in a certain directory with the necessary files placed where they need to be in sub-directories, etc.

So if my .exe moves anywhere else, or if I zip it and send it to someone and they try to open it, they can't - so either TclApp is not wrapping the files in correctly, or I'm not understand exactly how to organize my files and directories..? Can someone please tell me what's going on? Is there a particular organization or structure in which i need to organize my folders and directories before I wrap?

Much appreciated.

vpetrovic | Tue, 2014-06-17 11:53

So the issue was in my Tcl code, I didn't specify the files with a relative path from the source script.

I used: set home [file dirname [info script]];
and from there I could specify where all the files were in relation to my tcl script.

My new problem is that TclApp doesn't seem to be wrapping my .ico file correctly - or at all, I'm not sure.

My program will only execute correctly with the .ico icon in the top left corner when it is placed in the same directory on my system with the .ico file - even thought I've supposedly wrapped it in with the rest of my program.

I'm not entirely sure if this is a problem with TclApp or if or if the there is a bug in Tcl/Tk in relation to bitmaps, or if my code isn't correct.

has anyone else had any issues setting the main icon for your program in the top left corner of the screen with "wm iconbitmap" before?

vpetrovic | Fri, 2014-06-27 12:38

The issue was my .ico file only had one embedded size and color depth; The new icon I'm using works.

**There is still an officially documented bug with icons of size 256x256 that does not have a solution or workaround.**

Windows changed how it deals with icon files of 256x256 or greater. Rather than keeping the file format at .ico, png file data was embedded into icons of size 256x256 to keep the file size smaller (png files have compression.) This creates a variation in the filesize of the .ico file, which cannot work for TclApp, who's file size requirements are very specific.