On Apr 2, 3:01 pm, "Parv G." <ghotr... / yahoo.com> wrote:
> I'm trying to read/write a text file.
> code:
>
> $LOAD_PATH << "c:/path/to/resource/folder"
> file = File.new('resources/testResults.txt', "a")
> file.puts results
>
> I keep on getting an error: "...in `initialize': No such file or
> directory - ./resources/TestResults.txt (Errno::ENOENT)", when i run
> this file from SciTE (the editor that comes with ruby on windows, BUT
> when i run this from eclipse (RDT) the script works just fine.
>
> I really would like to avoid mixing in full file paths in my code.
> Can somebody offer some suggestions?
> Why isn't $LOAD_PATH working for me, even though i see the path i need
> in $LOAD_PATH?

$LOAD_PATH only works for #require and #load. It has no effect on
File.new.

T.