Project

General

Profile

Actions

Bug #9002

closed

Use simpler example for File#expand_path

Added by cha1tanya (Prathamesh Sonpatki) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.1.0dev (2013-07-20 trunk 42078) [x86_64-linux]
[ruby-core:57734]

Description

Use simpler example for File#exapnd_path when start_directory path is given.


Files

Updated by Eregon (Benoit Daloze) about 11 years ago

I don't know, the original example shows File.expand_path does resolve ".." and such.
Your example could be interpreted as File.expand_path being just File.join with reversed arguments.
On the other hand, ".." could be used just once in the example and probably still be clear (going to "/" does not make a lot of sense, one could just use "/bin" directly).

Updated by cha1tanya (Prathamesh Sonpatki) about 11 years ago

Can we give both examples? I think the original example is a bit hard to understand due to two "..". In the first example we can show normal use and in second example, as you pointed out, how to resolve "..".
Eregon (Benoit Daloze) wrote:

I don't know, the original example shows File.expand_path does resolve ".." and such.
Your example could be interpreted as File.expand_path being just File.join with reversed arguments.
On the other hand, ".." could be used just once in the example and probably still be clear (going to "/" does not make a lot of sense, one could just use "/bin" directly).

Updated by zzak (zzak _) about 11 years ago

  • Status changed from Open to Assigned

The original makes no sense to me, but I can see how it resolves ".." (... somehow).

I'm not even sure what the "/tmp/x" has to do with anything.

A patch to explain what's going on there would be nice, at least for my own sake :D

Updated by Eregon (Benoit Daloze) about 11 years ago

cha1tanya (Prathamesh Sonpatki) wrote:

Can we give both examples? I think the original example is a bit hard to understand due to two "..". In the first example we can show normal use and in second example, as you pointed out, how to resolve "..".

Yes, that sounds good to me, could you update your patch?

(Sorry for the long delay to answer, I missed your response)

Updated by Eregon (Benoit Daloze) about 11 years ago

  • Assignee changed from zzak (zzak _) to Eregon (Benoit Daloze)

This is better.
There is a typo "exapnd_path" and I would avoid references to your specific machine and Rails but use something more neutral. I will commit your patch with a couple changes.
Dir.pwd is also subject to change, so a static reference like FILE might be better.

Thank you for your contribution!

Actions #7

Updated by Eregon (Benoit Daloze) about 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r43386.
Prathamesh, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path.
    Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0