[Ironruby-core] C# running ruby scripts give error: no such file to load
lists at ruby-forum.com
Tue Oct 6 16:47:14 EDT 2009
Hello ironruby user,
Here I am with another question. This is a problem I ran in a few weeks
ago, found a workaround, but this workaround is far from perfect.
As some might already know, I am building an C# application and am using
ironruby to run rubyscripts.
Application located in:
Testscripts located in:
These testscripts uses custom made libraries located in:
But also they use standard ruby libraries located in:
So the top of the testscripts can look someting like:
Now the problem:
Running these these testscripts from the C# application (using e.g.
engine.ExecuteFile) results in the error: no such file to load --
'../Common/LibTestCase1' or 'win32ole' or whatever file is required.
It seems the scripts (or application) is trying to located the file
relative to the path the application is located.
This leads me to the workaround. Before running the testscript from the
application change the current directory of the application to the
location of the testscripts (using Environment.CurrentDirectory =
Since testscripts can be located deeper in the directory stucture I need
to keep changing the current directory of the application. You'll
understand that this is a pretty sucky workaround.
I have tried using SetLoadPath to include the directories where the
required files can be found, but this still gives the same error.
So I am looking for a more flexibel solution for this problem. Hopefully
someone here provide information to stear me in the correct direction.
Thanks in advance
Posted via http://www.ruby-forum.com/.
More information about the Ironruby-core