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

Viewed 35

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?

1 Answers

Pharo supports it in the form of a FileLocator:

(FileLocator home / '.ssh' / 'id_rsa.pub') fullName "=> '/home/esteban/.ssh/id_rsa.pub'"
Related