I have been having similar problems, storing a config file for my apps. I found that
Dir.chdir(File.dirname($PROGRAM_NAME))
Only returned '.' as a path. After further investigation using
File.expand_path($PROGRAM_NAME).gsub($PROGRAM_NAME,"")
for .shy files returned a new path each time where the contained rb file was unpacked to. eg.
C:/DOCUME~1/username/LOCALS~1/Temp/shoes-ShoesReadWriteTest.3540/
C:/DOCUME~1/username/LOCALS~1/Temp/shoes-ShoesReadWriteTest.4064/
So my config file was being created and stored in a different location each time, not very useful. To get around this problem I have gone the standard route and stored my config file in the users home directory. By calling:
Dir.chdir(ENV['HOME'])
I still do not know how you refference the original .shy or .exe location though if it was to point to a data file location.
Running:
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
Shoes Rasins