[feature] Directory - get parent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[feature] Directory - get parent

Stephen-71
Issue status update for
http://smalltalk.gnu.org/node/202
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/202

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     feature requests
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  swoolerton
 Updated by:   swoolerton
 Status:       active

There doesn't seem to be a method on Directory to get the parent
directory of the current Directory object. Is there any chance of
having such a method added to Directory.

This worked in any case:-

folderTrail := myPath tokenize: ( Directory pathSeparatorString ).  
parent :=  folderTrail last.

It would be quite useful to have a method supplying the "directory
trail" also, with an Array of all the Directories that comprise a path.

Thanks,
Stephen




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [feature] Directory - get parent

Paolo Bonzini-3
Issue status update for
http://smalltalk.gnu.org/project/issue/202
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/202

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     feature requests
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  swoolerton
 Updated by:   bonzinip
-Status:       active
+Status:       works for me

Actually there is:

    *  you can use File class>>#pathFor: to get the parent path as a
String from a String:




   File pathFor: Directory working


    *  you can use File>>#path to get the parent path as a String from
a File or Directory:


   (Directory name: Directory working) path


    *  you can use File>>#directory to get the parent path as a
Directory from a File or Directory:


   (Directory name: Directory working) directory

In 3.1 the File/Directory classes will be overhauled, including the
following: 1) the #directory method will be renamed to #parent; 2)
Directory working will return a directory.  So you will use the
following two snippets to get the enclosing directory as an object or
as a String, respectively:

   Directory working parent
   Directory working path




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Re: [feature] Directory - get parent

Stephen-71

>    *  you can use File>>#directory to get the parent path as a
> Directory from a File or Directory:
>
>
>   (Directory name: Directory working) directory

Thank you, this is just the one I wanted

Stephen


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk