Cross-platform means of getting user's home directory in Ruby? -
java has convienient system.getproperty("user.home")
user's "home" directory in platform-independent way. what's equivalent in ruby? don't have windows box play around with, , feel relying on tildes in filenames isn't cleanest way. there alternatives?
the file.expand_path
method uses unix convention of treating tilde (~
) specially, ~
refers current user's home directory , ~foo
refers foo
's home directory.
i don't know if there's better or more idiomatic way, file.expand_path('~')
should going.
Comments
Post a Comment