Robert Klemme
3/4/2009 10:40:00 PM
On 04.03.2009 23:11, Daniel Mantilla wrote:
> Hi all, I have a little ruby script that accepts a file name as a
> parameter. Given the company standards, the script has to be deployed on
> a specific "bin" folder. It has a cryptic name so a more "human" symlink
> was created on the same folder, let's call it "run_process". I ended up
> with something like this:
>
> some_path/bin/run_process
> some_path/bin/cryptic_ruby_script.rb
So you have a symlink "run_process" which points to
"cryptic_ruby_script.rb" in the same directory?
> The "some_path/bin" appears on the path of the user but every time he
> runs the script he has to provide the expanded file name otherwise the
> script will try to find the file on some_path/bin folder.
>
> Is there a way to avoid this by just executing "run_process my_file" ?
I am not sure I understand your problem. Since the symlink and the real
file reside in the same directory all relative paths must work properly.
If you want to just use the file name, then you need to add a directory
to get the full path. I have no idea how that directory is defined,
i.e. is it relative to the binary, is it a system fixed directory etc.?
Please fill in the missing information.
In the meantime you can experiment with File.readlink for reading symlinks.
Cheers
robert