FilePath creation

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

FilePath creation

Stephen-71
Ah, how does one create a FilePath instance?

I can't find any class "instance creation" methods in the FilePath
documentation.

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: FilePath creation

Joachim Jaeckel
Hi Stephen,

> Ah, how does one create a FilePath instance?

Because FilePath is the superclass of File, I'd try:

specialFile := File path: '/home/joe'.
specialFile exists ifTrue: [ 'Yes, its there!' printNl ]

...just an idea...

Regards,
Joachim.


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

Re: FilePath creation

Stephen Woolerton
Thanks - I had checked Directory and FilePath for superclasses but not
File.

Stephen

Joachim Jaeckel wrote:

> Hi Stephen,
>
>> Ah, how does one create a FilePath instance?
>
> Because FilePath is the superclass of File, I'd try:
>
> specialFile := File path: '/home/joe'.
> specialFile exists ifTrue: [ 'Yes, its there!' printNl ]
>
> ...just an idea...
>
> Regards,
> Joachim.
>


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

Re: FilePath creation

Paolo Bonzini-3
In reply to this post by Stephen-71
Stephen wrote:
> Ah, how does one create a FilePath instance?
>
> I can't find any class "instance creation" methods in the FilePath
> documentation.

FilePath is abstract, you use "File name: 'aaa'" or "'xxx' asFile" or
"File path: 'bbb'".

The difference between #name: and the others is that #name: forces the
File to be on an absolute path.  Example:

Directory working: '/usr/bin'.
a := File name: 'gst'.   " ==> <File /usr/bin/gst>"
b := File path: 'gst'.   " ==> <File gst>
Directory working: Directory home.
a size printNl.
b size printNl.  "No such flie or directory"

Paolo


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