Making your filenames work in Linux

So I am in the middle of porting the NYC Smalltalk servers to CentOS. One of the issues that I ran into is that in Windows I setup the “start in” directory for the images (VisualWorks images i.e not gifs, etc) that I launch to be the directory where the image resides. In Linux I did not know how to do this. As a matter of fact, some folks that I know did not know either and build their own mechanism for resolving filenames. However, I want simply for code that worked in Windows to work in Linux without change or without changing the respective file locations.

Basically I wanted for the following to be true:

Given that ‘blah.txt’ exits in the same directory as where the current image exits then the following should be true:

(ObjectMemory imageName asFilename directory) = ‘blah.txt’ asFilename directory.

Well, thanks to one of the member of the VisualWorks Non-Commercial List I was able to to as much. The answer is simple: “change to” the working directory in your shell script to be what you need. This exactly what we do with a Windows shortcut except that in Linux we use scripting. So for example my startup script looks like this:

VISUALWORKS=/apps/visualworks/vw7.3.1

export VISUALWORKS

cd /apps/visualworks/vw7.3.1/image/wiki

/apps/visualworks/vw7.3.1/bin/linux86/visual /apps/visualworks/vw7.3.1/image/wiki/visual.im

Hope this is useful, it sure saved me some headaches.