From: John L. <jla...@gm...> - 2009-05-28 22:57:20
|
On Thu, May 28, 2009 at 11:19 AM, lostgallifreyan <los...@gm...> wrote: > This appears with both the older and latest wxLua, and might even be native to Lua, but I don't think so. > > If I open a data file in the same location as the script, bitmaps for toolbar buttons in a subdirectory are found, if I open a data file elsewhere, they are not! That means that the data file path, not the script file path, is being assumed to be the working directory, which is definitely odd. (This is my best assumption anyway, I don't know how to prove it because if I ask it to print the path, it just prints what I told it, not the expanded path it tried to use). > > Normally I could do this: > PATH="./Bitmaps/" > > But for now I have to do this to force wxLua to look at the right path to chose as working directory: > PATH=string.gsub(arg[0],"^(.+[/\\]).+$","%1").."Bitmaps/" > > It works, but it's a clumsy method. At least it's portable, it accepts non-Windows path separators... This is a typical problem of finding where a program's external resources are and is not unique to wxLua or Lua. The way you do it is pretty a pretty standard way. You may want to create a shortcut to your app and set the "Start In" path to the directory of the program and its resources. Regards, John Labenski |