[Wtr-general] What is the funtion in Ruby equivalent as strrchrin C
Jason He
Jason.He at resilience.com
Mon Mar 5 21:24:05 EST 2007
Hi Charley,
You gave a convenient way to achieve the goal.
By the way, I guess a double quote is missing before the last bracket in the second line when using expand_path().
Thanks very much for your help.
Jason
________________________________
From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Charley Baker
Sent: 2007年3月6日 0:08
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] What is the funtion in Ruby equivalent as strrchrin C
There are quite a few ways to do this, here's one using expand_path:
f = File.dirname(__FILE__) # get your test directory
puts File.expand_path("#{f}/..) # get the directory above your test directory
-Charley
On 3/5/07, Jason He < Jason.He at resilience.com> wrote:
Dear all,
I use "example_logger1.rb" and "test_logger1.rb" C:\watir1145\examples\logging to logging, but a problem is that the generated log file will under the same directory with test cases,
I want put the generated logs into a separated directory.
The code in the "example_logger1.rb" is that,
logger = CoreLogger.new(File.join(File.dirname(__FILE__), "#{fileNamePrefix}_#{time}.txt") ,2, 1000000)
Here the "File.dirname(__FILE__)" will return the directory who stores test cases.
Now I want get the directory upper of the directory of "File.dirname(__FILE__)", is there a equivalent function or Regexp in Ruby/Watir as strrchr/substr in C to achieve this?
Any hint or help is appreciated.
Regards,
Jason
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070305/ba430973/attachment-0001.html
More information about the Wtr-general
mailing list