What I am trying to achieve is creating a C# application that wil run several Ruby scripts from a several locations.
In my C# project I have added references to several .dll files (e.g. IronRuby.dll, IronRuby.Libraries.dll, Microsoft.Scripting.dll, etc) in order to execute the ruby scripts.
Running the application results in the following error message:
- No such file or directory - Test
The application wil run without errors if:
- Ruby scripts do not use require
- The require is defined using absolute paths
- Application is in same directory as the Ruby scripts
I do not like any of these solutions very much. I would like the application to know where to look for the required ruby classes/scripts. Is this possible or do I need to find another solution for my application?
All information on this problem/subject/solution is welcome.
Is there some sort of path that you can set in Ruby to find the Test location?
Yes, this path is set for Ruby via the environment variable RUBYPATH (or something). Running the ruby scripts from command line using Ruby is not a problem. Running them from the C# application gives error message.
Do you need to set the working directory to the same path as the script before you execute it? Environment.CurrentDirectory does it if i remember correctly.
NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
Bookmarks