Re: file io within starpack's vfs
Pat Thoyts <[email protected]> Fri, 5 Feb 2010 12:00:56 +0000
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <[email protected]> |
On 5 February 2010 11:26, jemptymethod <[email protected]> wrote: > I'm surprised that I can do file io within the vfs when I wrap up a > starpack as an .exe. Surprised but pleased: I thought that for this > scenario I was going to have to deploy tclkit and a .kit file. > > What if the data I want to write within the vfs becomes "too large". > Can the .exe expand in size? > > Any clarification on the inner workings of starkits/starpacks would be > appreciated. Not on windows. The image file (ie: tclkit.exe) is locked by the OS when it loads the file to execute it. If you start tclkit you can do a few tests in the console: % cd [info nameofexecutable] % glob * boot.tcl config.tcl lib tclkit.ico % set f [open junk w] rechan89 % puts $f [string repeat a 10240] % close $f % glob * boot.tcl config.tcl junk lib tclkit.ico At the point it looks like you saved your new file - but if you exit and restart it will have gone. The 'rechan89' channel shown above is an in-memory stream. If we try to commit it to the database that provides the virtual filesystem we will get an access denied error. On unix you can modify the running image file. However on both systems the image may be located somewhere the user does not have write access. For this reason it is usualy best to store data in the users home directory or a subdirectory of that. Or on windows under $env(APPDATA). If you dig around on the wiki.tcl.tk site you can find out more about metakit virtual filesystems. If you are using metakit. If it was tclkit-gui or tclkit-cli then that is a readonly version that can access the database but not change it. Its also possible to base starkits on zip files and use the zip vfs to load them. But the usual 'tclkit' uses a metakit database as the vfs with zlib compressed blobs for the files. The database is appended to the end of the executable image for a starpack. Pat Thoyts -- You received this message because you are subscribed to the "starkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/starkit?hl=en