www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - phobos: std.path enhancements

reply SLI <SLI_member pathlink.com> writes:
How about this enhancement for std.path:

new method:
char[] parent( char[] path, int up = 1 )
returns the parent path name of the given path, up indicates the levels for
"walking up", ´0´ would simply return the path parameter, ´1´ the parent, ..

extended method:
char[] join( char[] p1, char[] p2 )
it would be really nice if join() could also join "real" relative paths (p2)
such as "../sibling".

If helpfull I could provide the "authors" with a win specific implementation
e.g. to be used as a starting point.
Jun 12 2006
parent reply Carlos Santander <csantander619 gmail.com> writes:
SLI escribió:
 How about this enhancement for std.path:
 
 new method:
 char[] parent( char[] path, int up = 1 )
 returns the parent path name of the given path, up indicates the levels for
 "walking up", ´0´ would simply return the path parameter, ´1´ the parent, ..
 

This was already answered in the bugs ng.
 extended method:
 char[] join( char[] p1, char[] p2 )
 it would be really nice if join() could also join "real" relative paths (p2)
 such as "../sibling".
 

I think this was proposed before and, IIRC, people generally didn't agree mainly because symbolic links would make it confusing or difficult or something else.
 If helpfull I could provide the "authors" with a win specific implementation
 e.g. to be used as a starting point.
 
 

-- Carlos Santander Bernal
Jun 12 2006
parent reply SLI <SLI_member pathlink.com> writes:
In article <e6jsbm$2cl5$1 digitaldaemon.com>, Carlos Santander says...
SLI escribió:
 How about this enhancement for std.path:
 
 new method:
 char[] parent( char[] path, int up = 1 )
 returns the parent path name of the given path, up indicates the levels for
 "walking up", ´0´ would simply return the path parameter, ´1´ the parent, ..
 

This was already answered in the bugs ng.

If you refer to bug #189, than Walter just said that the bug ng. is not a good place for discussing this. But maybe you were refering to another bug.
 extended method:
 char[] join( char[] p1, char[] p2 )
 it would be really nice if join() could also join "real" relative paths (p2)
 such as "../sibling".
 

I think this was proposed before and, IIRC, people generally didn't agree mainly because symbolic links would make it confusing or difficult or something else.
 If helpfull I could provide the "authors" with a win specific implementation
 e.g. to be used as a starting point.
 
 


Sorry, did not found this thread you are talking about. Can you direct me to it? I just entered the "D-Train" a few days ago!!
-- 
Carlos Santander Bernal

Jun 12 2006
parent Carlos Santander <csantander619 gmail.com> writes:
SLI escribió:
 In article <e6jsbm$2cl5$1 digitaldaemon.com>, Carlos Santander says...
 SLI escribió:
 How about this enhancement for std.path:

 new method:
 char[] parent( char[] path, int up = 1 )
 returns the parent path name of the given path, up indicates the levels for
 "walking up", ´0´ would simply return the path parameter, ´1´ the parent, ..


If you refer to bug #189, than Walter just said that the bug ng. is not a good place for discussing this. But maybe you were refering to another bug.

I mean the reply you got from Unknown W. Brackets: " I thought getDirName() was "parent()" (except named like I expect it to be, and available in other runtime libraries.) You'd just call it multiple times for higher "up" values - no? "
 extended method:
 char[] join( char[] p1, char[] p2 )
 it would be really nice if join() could also join "real" relative paths (p2)
 such as "../sibling".

because symbolic links would make it confusing or difficult or something else.
 If helpfull I could provide the "authors" with a win specific implementation
 e.g. to be used as a starting point.


Sorry, did not found this thread you are talking about. Can you direct me to it? I just entered the "D-Train" a few days ago!!

Sorry, I don't know what that thread might be. Maybe try searching for "join relative paths" from http://www.digitalmars.com/d/index.html
 -- 
 Carlos Santander Bernal


-- Carlos Santander Bernal
Jun 12 2006