On Thu, May 28, 2009 at 11:19 AM, lostgallifreyan <lostgallifre...@gmail.com> 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 ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users