# Re: wxRuby & RubyScript2exe

**URL:** <https://www.ruby-forum.com/t/re-wxruby-rubyscript2exe/133218>\
**Category:** wxRuby\
**Created:** [March 28, 2008, 8:28pm UTC](https://www.ruby-forum.com/t/re-wxruby-rubyscript2exe/133218 "2008-03-28T20:28:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_McGavren](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e79b87/32.png) [@Jay\_McGavren](https://www.ruby-forum.com/u/Jay_McGavren)\
**Post date:** [March 28, 2008, 8:28pm UTC](https://www.ruby-forum.com/t/re-wxruby-rubyscript2exe/133218/1 "2008-03-28T20:28:46Z")

</div>

Matthew Webb wrote:

> 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?

The problem is that this script depends on an external file, which  
rubyscript2exe doesn’t include in the .exe (and therefore not in the  
eee temp folder). You’ll need to employ a little cleverness to  
include the resource with the executable.

This page talks about including library files for another GUI  
framework in the .exe, and should be adaptable for including resource  
files:

[http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips\_rubyscript2exe](http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_rubyscript2exe)

> Those lines copy all the files & folders inside the  
> “run\_dep” folder to the folder where rubyscript2exe will  
> extract your application. The begin/rescue is needed  
> because that fails when you run your application the first  
> time in rubyscript2exe, to create the .exe.

You’ll of course need to modify the path referenced in the script such  
that it points to the temp location that the resource gets  
decompressed to.

BTW, overall wxRuby works _beautifully_ with rubyscript2exe, which is  
one of my favorite features about it.

-Jay McGavren

---

<div class="post-metadata">

**Author:** ![Jay\_McGavren](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e79b87/32.png) [@Jay\_McGavren](https://www.ruby-forum.com/u/Jay_McGavren)\
**Post date:** [March 29, 2008, 2:19am UTC](https://www.ruby-forum.com/t/re-wxruby-rubyscript2exe/133218/2 "2008-03-29T02:19:40Z")

</div>

Jay McGavren wrote:

> rubyscript2exe doesn’t include in the .exe (and therefore not in the
> 
> > require ‘rubyscript2exe’  
> > Those lines copy all the files & folders inside the  
> > BTW, overall wxRuby works _beautifully_ with rubyscript2exe, which is

Thanks for the advice, I placed the following code at the start of the  
program…

require ‘rubyscript2exe’  
require ‘fileutils’  
require ‘pathname’

p0 = Pathname.new(RUBYSCRIPT2EXE.appdir)  
root\_runtime = p0.parent.to\_s  
begin  
FileUtils.cp\_r(‘run\_dep/.’, root\_runtime)  
rescue  
end

I changed this line from…

icon\_file = File.join( File.dirname( **FILE** ), “mondrian.png”)

to…

icon\_file = File.join( File.dirname(RUBYSCRIPT2EXE.appdir),  
“mondrian.png”)

Then I created a folder called ‘run\_dep’ where the script was located &  
I placed the icons in that folder.

The script was “compiled” with ‘rubyscript2exe minimal.rb  
–rubyscript2exe-rubyw’

When I executed it the icons loaded & the program worked.
