melkyades
melkyades

Reputation: 1786

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?

Upvotes: 4

Views: 75

Answers (1)

EstebanLM
EstebanLM

Reputation: 4357

Pharo supports it in the form of a FileLocator:

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

Upvotes: 4

Related Questions