|
| VALUE | rb_file_s_expand_path (int argc, const VALUE *argv) |
| | Identical to rb_file_expand_path(), except how arguments are passed.
|
| VALUE | rb_file_expand_path (VALUE fname, VALUE dname) |
| | Identical to rb_file_absolute_path(), except it additionally understands ~.
|
| VALUE | rb_file_s_absolute_path (int argc, const VALUE *argv) |
| | Identical to rb_file_absolute_path(), except how arguments are passed.
|
| VALUE | rb_file_absolute_path (VALUE fname, VALUE dname) |
| | Maps a relative path to its absolute representation.
|
| VALUE | rb_file_dirname (VALUE fname) |
| | Strips a file path's last component (and trailing separators if any).
|
| int | rb_find_file_ext (VALUE *feature, const char *const *exts) |
| | Resolves a feature's path.
|
| VALUE | rb_find_file (VALUE path) |
| | Identical to rb_find_file_ext(), except it takes a feature name and is extension at once, e.g.
|
| VALUE | rb_file_directory_p (VALUE _, VALUE path) |
| | Queries if the given path is either a directory, or a symlink that (potentially recursively) points to such thing.
|
| VALUE | rb_str_encode_ospath (VALUE path) |
| | Converts a string into an "OS Path" encoding, if any.
|
| int | rb_is_absolute_path (const char *path) |
| | Queries if the given path is an absolute path.
|
| rb_off_t | rb_file_size (VALUE file) |
| | Queries the file size of the given file.
|
Public APIs related to rb_cFile.
- Author
- Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
- Copyright
- This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.
- Warning
- Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
- Note
- To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.
Definition in file file.h.
Strips a file path's last component (and trailing separators if any).
This function is relatively simple on POSIX environments; just splits the input with /, strips the last one, if something remains joins them again, otherwise the return value is ".". However when it comes to Windows this function is quite very much complicated. We have to take UNC etc. into account. So for instance "C:foo"'s dirname is "C:.".
- Parameters
-
| [in] | fname | File name to strip. |
- Exceptions
-
- Returns
- A dirname of fname.
- Note
- This is a "pure" operation; it computes the return value solely from the passed object and never does any file IO.
Definition at line 4890 of file file.c.
| int rb_find_file_ext |
( |
VALUE * | feature, |
|
|
const char *const * | exts ) |
Resolves a feature's path.
This function takes for instance "json" and [".so", ".rb"], and iterates over the $LOAD_PATH to see if there is either json.so or json.rb in the directory.
This is not what everything require does, but at least require is built on top of it.
- Parameters
-
| [in,out] | feature | File to search, and return buffer. |
| [in] | exts | List of file extensions. |
- Exceptions
-
- Return values
-
| 0 | Not found |
| otherwise | Found index in ext, plus one. |
- Postcondition
- *feature is a resolved path.
Definition at line 6533 of file file.c.