Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Pharo support home (~) as part of a path?

I am trying to use a path relative to home directory (~/.ssh/id_rsa.pub) in Pharo 8 but it does not work. For example:

'~/.ssh/id_rsa.pub' asFileReference exists    ==> false

and the path is

'~/.ssh/id_rsa.pub' asPath      ==> "Path / 'home' / 'ubuntu' / 'stuff' / '~' / '.ssh' / 'id_rsa.pub'"

Now, in String>>asPath the example says '~/Desktop' asPath, so I'm guessing this used to be supported and then the API was changed.

How do I get a full path from something like '~/.ssh/id_rsa.pub' in pharo?

like image 832
melkyades Avatar asked Oct 24 '25 09:10

melkyades


1 Answers

Pharo supports it in the form of a FileLocator:

(FileLocator home / '.ssh' / 'id_rsa.pub') fullName "=> '/home/esteban/.ssh/id_rsa.pub'"
like image 140
EstebanLM Avatar answered Oct 27 '25 01:10

EstebanLM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!