From: Domenic P. on
I just ran into this exact problem. I fixed my particular problem. Here
is what I did.

I found that I could compile some scripts (even complex ones) but not
others. I finally realized what the problem was. It appears ocra can't
handle if your script changes the working directory in the script. I
believe orca should save the directory it is run in and then reference
that directory but it apparently assumes the directory you start your
script in is the same directory when it finishes. In my case, I am
changing the directory.

in my case, I can reproduce this issue with the following code.

#start of script
puts Dir.pwd
dir = "d:/" #Dir.pwd produces "c:\" so I changed to another drive
(another directory will produce same result)
Dir.chdir(dir)
puts Dir.pwd
puts "script complete"
#end of script

I am not by any means an expert Ruby developer so I'm sure much of my
nomenclature isn't correct but this is what I did to fix my problem.

thanks,
Domenic



Thomas B. wrote:
> Hello.
>
> I was trying to use Ocra with Ruby 1.9.1 on Windows. It creates the
> executable but then when I try to run it, all I get is "Failed to create
> directory" on the console, and the program finishes. It's hard to find
> any info about this error, so I'm asking if any of you happened to
> encounter and solve this problem, and could share their solution?
>
> Thanks
> TPR.

--
Posted via http://www.ruby-forum.com/.

From: Domenic P. on
Just to be clear, the following runs correctly after compiling:

puts Dir.pwd
olddir = Dir.pwd
dir = "d:\\"
Dir.chdir(dir)
puts Dir.pwd
Dir.chdir(olddir)
puts Dir.pwd
puts "script complete"


whereas this code does not run correctly after compiling.

puts Dir.pwd
olddir = Dir.pwd
dir = "d:\\"
Dir.chdir(dir)
puts Dir.pwd
puts "script complete"

Domenic P. wrote:
> I just ran into this exact problem. I fixed my particular problem. Here
> is what I did.
>
> I found that I could compile some scripts (even complex ones) but not
> others. I finally realized what the problem was. It appears ocra can't
> handle if your script changes the working directory in the script. I
> believe orca should save the directory it is run in and then reference
> that directory but it apparently assumes the directory you start your
> script in is the same directory when it finishes. In my case, I am
> changing the directory.
>
> in my case, I can reproduce this issue with the following code.
>
> #start of script
> puts Dir.pwd
> dir = "d:/" #Dir.pwd produces "c:\" so I changed to another drive
> (another directory will produce same result)
> Dir.chdir(dir)
> puts Dir.pwd
> puts "script complete"
> #end of script
>
> I am not by any means an expert Ruby developer so I'm sure much of my
> nomenclature isn't correct but this is what I did to fix my problem.
>
> thanks,
> Domenic
>
>
>
> Thomas B. wrote:
>> Hello.
>>
>> I was trying to use Ocra with Ruby 1.9.1 on Windows. It creates the
>> executable but then when I try to run it, all I get is "Failed to create
>> directory" on the console, and the program finishes. It's hard to find
>> any info about this error, so I'm asking if any of you happened to
>> encounter and solve this problem, and could share their solution?
>>
>> Thanks
>> TPR.

--
Posted via http://www.ruby-forum.com/.