[wxruby-users] wxRuby & RubyScript2exe

Alex Fenton alex at pressure.to
Thu Mar 27 19:58:50 EDT 2008


Matthew Webb wrote:
> I've got wxruby (1.9.5) & rubyscript2exe (0.5.3) installed & I'm using 
> Windows Vista.
>
> I'm trying to use rubyscript2exe to turn one of the wxruby sample 
> programs into an .exe.
>
> The sample is in the controls folder & is called controls.rb.
>
> I use 'rubyscript2exe controls.rb --rubyscript2exe-verbose' to 
> "compile" it.
>
> But when I try to run it I get the following error:
>
> Bitmap file does not exist: 
> C:\Users\Matthew\eee\eee.controls.exe.4\app/icons/list.xpm (ArgumentError)
The problem is that the bitmap file isn't included in the bundled-up 
package that rubyscript2exe creates and later unpacks when the .exe is run.

The simple way is to manually tell rubyscript2exe to add the .xpm file 
to the bundle. To do this, add a constant to the beginning of the file 
with an array of files that should be included.

RUBYSCRIPT2EXE.dlls = [ 'icons/list.xpm', ... ]

(Or it might be RUBYSCRIPT2EXE.libs = [...]
I can't remember and can't test it right now. See 
http://www.erikveen.dds.nl/rubyscript2exe/#3.3.1 )

A more complex but perhaps better way for bigger apps is to build the 
.exe as normal, then distribute it and the icons packaged up as a zip, a 
tar, or using an installer like NSIS.

Then, at runtime, test if the application is running from within 
rubyscript2exe, find out where it's installed, and load image files from 
that location. Wx::ArtProvider can also help here. An example of this 
approach below - see the part where it sets WEFT_SHAREDIR

http://weft-qda.rubyforge.org/svn/trunk/weft-qda/weft-qda.rb

alex









More information about the wxruby-users mailing list