A
Alpha Blue
Hi everyone,
I'm setting up my RUBYLIB variables for use with custom libraries I've
created. I have the following working properly:
C:/lib/wxruby/lib [this points to the custom library path I have set]
Everything is verified with ruby -e "puts $:" ..
The first module I created is a module called public_instance_methods.rb
Location: C:/lib/wxruby/lib/public_instance_methods.rb
module PublicInstanceMethods
# This method sets the default icon for the given window or frame
def set_icon_file(file)
icon_file = File.join(File.dirname(__FILE__),"..","icons",file)
set_icon Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_ICO)
end
end
My default working project directory is:
E:\project\lib\
"" \core
"" \icons
"" \images
In E:\project\lib\core\main.rb I have..
require 'public_instance_methods'
include PublicInstanceMethods
class GuiMain < XrcFrameMain
def initialize
super()
set_icon_file("test.ico")
end
end
Which results into an error saying:
Icon file does not exist:
C:/lib/wxruby/lib/../icons/kirin.ico (ArgumentError)
.. which means that it's looking in the lib directory of the included
module and not the working directory of the application. How should I
set this method up so that it includes the right path to the ico file?
I'm setting up my RUBYLIB variables for use with custom libraries I've
created. I have the following working properly:
C:/lib/wxruby/lib [this points to the custom library path I have set]
Everything is verified with ruby -e "puts $:" ..
The first module I created is a module called public_instance_methods.rb
Location: C:/lib/wxruby/lib/public_instance_methods.rb
module PublicInstanceMethods
# This method sets the default icon for the given window or frame
def set_icon_file(file)
icon_file = File.join(File.dirname(__FILE__),"..","icons",file)
set_icon Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_ICO)
end
end
My default working project directory is:
E:\project\lib\
"" \core
"" \icons
"" \images
In E:\project\lib\core\main.rb I have..
require 'public_instance_methods'
include PublicInstanceMethods
class GuiMain < XrcFrameMain
def initialize
super()
set_icon_file("test.ico")
end
end
Which results into an error saying:
Icon file does not exist:
C:/lib/wxruby/lib/../icons/kirin.ico (ArgumentError)
.. which means that it's looking in the lib directory of the included
module and not the working directory of the application. How should I
set this method up so that it includes the right path to the ico file?