Bug #9002
closedUse simpler example for File#expand_path
Added by cha1tanya (Prathamesh Sonpatki) about 11 years ago. Updated about 11 years ago.
Description
Use simpler example for File#exapnd_path when start_directory path is given.
Files
0001-Use-simpler-example-for-File-expand_path-with-dir_st.patch (719 Bytes) 0001-Use-simpler-example-for-File-expand_path-with-dir_st.patch | cha1tanya (Prathamesh Sonpatki), 10/09/2013 02:06 AM | ||
0001-Use-simpler-example-for-File.expand_path.patch (1.37 KB) 0001-Use-simpler-example-for-File.expand_path.patch | cha1tanya (Prathamesh Sonpatki), 10/19/2013 10:00 PM |
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 cha1tanya (Prathamesh Sonpatki) about 11 years ago
- File 0001-Use-simpler-example-for-File.expand_path.patch 0001-Use-simpler-example-for-File.expand_path.patch added
Updated based on suggestions of @zzak (zzak _) and @Eregon (Benoit Daloze). Please take a look
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!
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]
Updated by cha1tanya (Prathamesh Sonpatki) about 11 years ago
Thanks Benoit :)