larsch / ocra

One-Click Ruby Application Builder
http://ocra.rubyforge.org/
833 stars 84 forks source link

Ocra ignores thread.rb file in FXRuby lib directory #194

Closed Youngv closed 1 year ago

Youngv commented 1 year ago

I encountered a problem when attempting to package a program written with FXRuby using Ocra. I noticed that a "thread.rb" file located in the FXRuby lib directory was being ignored by Ocra during the packaging process. Is there a way to bypass this ignore logic?

E, [2023-06-12T11:50:56.103906 #16236] ERROR -- : cannot load such file -- fox16/thread

https://github.com/larsch/ocra/blob/893fe8821af9986357bfc8d6c0101ce34ccb5c10/bin/ocra#L191

Youngv commented 1 year ago

--gem-files=C:/Ruby26/lib/ruby/gems/2.6.0/gems/fxruby-1.6.46-x86-mingw32/lib/fox16/thread.rb

  require 'fileutils'
  unless ENV["OCRA_EXECUTABLE"].nil?
    thread_rb = File.expand_path('lib/ruby/gems/2.6.0/gems/fxruby-1.6.46-x86-mingw32/lib/fox16/thread.rb', File.dirname(ENV["OCRA_EXECUTABLE"]))
    FileUtils.cp('vendor/fxruby-1.6.46-x86-mingw32/lib/fox16/thread.ocra', thread_rb) unless File.exist?(thread_rb)

    ruby2_keywords_rb = File.expand_path('lib/ruby/gems/2.6.0/gems/ruby2_keywords-0.0.5/lib/ruby2_keywords.rb', File.dirname(ENV["OCRA_EXECUTABLE"]))
    FileUtils.cp('vendor/ruby2_keywords-0.0.5/lib/ruby2_keywords.ocra', ruby2_keywords_rb) unless File.exist?(ruby2_keywords_rb)
  end

Rename the thread.rb as thread.ocra and put in your src/vendor dir, then put it into lib dir the first time your pargram run.

I found out that the issue with Ocra ignoring the "thread.rb" file in FXRuby lib directory only occurs when using an Inno Setup script. I was able to work around the problem by including the file explicitly.

Although I found a solution to the problem, I believe this may still be an issue for other users who encounter the same problem. Any insights or suggestions on how to fix this issue without the need for a workaround would be appreciated.