wxRuby & RubyScript2exe

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)

Do you have any ideas how I could solve this problem?

Matthew Webb wrote:

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

Alex F. wrote:

I use ‘rubyscript2exe controls.rb --rubyscript2exe-verbose’ to
The simple way is to manually tell rubyscript2exe to add the .xpm file
.exe as normal, then distribute it and the icons packaged up as a zip, a

It would seem that the problem isn’t ‘list.xpm’ not loading but
‘mondrian.ico’ not loading.

I’ve added the following two lines to the beginning of ‘controls.rb’…

require “rubyscript2exe”
RUBYSCRIPT2EXE.bin = [“mondrian.ico”]

When I run the .exe I get this error…

Icon file does not exist:
C:\Users\Matthew\eee\eee.controls.exe.2\app/mondrian.ico (ArgumentError)

It’s really strange because ‘mondrian.ico’ is in the same folder as
‘Controls.rb’ so I’d expect it to be found.

Matthew Webb wrote:

Icon file does not exist:
C:\Users\Matthew\eee\eee.controls.exe.2\app/mondrian.ico (ArgumentError)

It’s really strange because ‘mondrian.ico’ is in the same folder as
‘Controls.rb’ so I’d expect it to be found.
You’ve put it in the ‘bin’ dir of the package, but controls.rb is in the
‘app’ dir. controls.rb loads the icon file like this:

Icon.new( File.join( File.dirname(FILE), “mondrian.ico”),
Wx::BITMAP_TYPE_ICO )

i.e. relative to its position. So it looks in the app dir, doesn’t find
it and gives the error you saw. You’ll either need to put the icon file
somewhere different in the bundle, or change that code.

You might find it helpful to unpack the bundle rubyscript2exe creates to
see the directory structure. See the page for more details, but
basically run it with the argument —eee-justextract

alex

Alex F. wrote:

When I run the .exe I get this error…
Icon.new( File.join( File.dirname(FILE), “mondrian.ico”),
alex


wxruby-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wxruby-users

Okay I’ve finally managed to fix the problem I was having.

I found the following thread regarding rubyscript2exe & image loading…

http://objectmix.com/ruby/303278-re-rubyscript2exe-cannot-put-picture-project.html

If I rename the controls.rb file to init.rb & then “compile” the entire
controls Directory like…

C:\Users\Matthew\Desktop>rubyscript2exe controls/

it works fine.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs