End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
File.absolute_path
File.absolute_path(file_name [, dir_string] ) → abs_file_name
file.c
View on GitHub ↗
static VALUE
s_absolute_path(int c, const VALUE * v, VALUE _)
{
return rb_file_s_absolute_path(c, v);
}
Converts a pathname to an absolute pathname. Relative paths are referenced from the current working directory of the process unless dir_string is given, in which case it will be used as the starting point. If the given pathname starts with a “~” it is NOT expanded, it is treated as a normal directory name.
Example
File.absolute_path("~oracle/bin") #=> "<relative_path>/~oracle/bin"