Ruby: include/ruby/internal/intern/file.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Functions
file.h File Reference

Public APIs related to rb_cFile. More...

`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/value.h"`

Go to the source code of this file.

## Functions
VALUE | rb_file_s_expand_path (int, const VALUE *)
VALUE | rb_file_expand_path (VALUE, VALUE)
VALUE | rb_file_s_absolute_path (int, const VALUE *)
VALUE | rb_file_absolute_path (VALUE, VALUE)
VALUE | rb_file_dirname (VALUE fname)
int | rb_find_file_ext (VALUE *, const char *const *)
VALUE | rb_find_file (VALUE)
VALUE | rb_file_directory_p (VALUE, VALUE)
VALUE | rb_str_encode_ospath (VALUE)
int | rb_is_absolute_path (const char *)

## Detailed Description

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.

## Function Documentation

## ◆ rb_file_absolute_path()

VALUE rb_file_absolute_path | ( | VALUE | fname,
|  | VALUE | dname
| ) |  |

Definition at line 4157 of file file.c.

References check_expand_path_args, expand_path, and EXPAND_PATH_BUFFER.

Referenced by rb_f_require_relative(), and rb_file_s_absolute_path().

## ◆ rb_file_directory_p()

VALUE rb_file_directory_p | ( | VALUE | obj,
|  | VALUE | fname
| ) |  |

Definition at line 1646 of file file.c.

References Qfalse, Qtrue, S_ISDIR, and stat.

Referenced by Init_Dir(), and Init_File().

## ◆ rb_file_dirname()

VALUE rb_file_dirname | ( | VALUE | fname | ) |

Definition at line 4732 of file file.c.

References FilePathStringValue, isdirsep, name, rb_enc_copy(), rb_enc_get(), rb_str_cat(), rb_str_new, rb_usascii_str_new2, root, RSTRING_LEN, skipprefix, StringValueCStr, strrdirsep, and top.

Referenced by rb_f_require_relative().

## ◆ rb_file_expand_path()

VALUE rb_file_expand_path | ( | VALUE | fname,
|  | VALUE | dname
| ) |  |

Definition at line 4103 of file file.c.

References check_expand_path_args, expand_path, and EXPAND_PATH_BUFFER.

Referenced by rb_file_s_expand_path().

## ◆ rb_file_s_absolute_path()

VALUE rb_file_s_absolute_path | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 4164 of file file.c.

References argc, argv, Qnil, rb_check_arity, and rb_file_absolute_path().

## ◆ rb_file_s_expand_path()

VALUE rb_file_s_expand_path | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 4116 of file file.c.

References argc, argv, Qnil, rb_check_arity, and rb_file_expand_path().

## ◆ rb_find_file()

VALUE rb_find_file | ( | VALUE | path | ) |

Definition at line 6404 of file file.c.

References f, MAXPATHLEN, RARRAY_AREF, RARRAY_LEN, rb_enc_associate_index(), rb_file_expand_path_internal(), rb_file_load_ok(), RB_GC_GUARD, rb_get_expanded_load_path(), rb_get_path(), rb_is_absolute_path(), rb_str_resize(), rb_str_tmp_new(), rb_usascii_encindex, RSTRING_LEN, RSTRING_PTR, str, and StringValueCStr.

Referenced by rb_load().

## ◆ rb_find_file_ext()

int rb_find_file_ext | ( | VALUE * | filep,
|  | const char *const * | ext
| ) |  |

Definition at line 6345 of file file.c.

References f, MAXPATHLEN, RARRAY_AREF, RARRAY_LEN, rb_enc_associate_index(), rb_file_expand_path_internal(), rb_file_load_ok(), RB_GC_GUARD, rb_get_expanded_load_path(), rb_get_path(), rb_is_absolute_path(), rb_str_cat2, rb_str_dup(), rb_str_resize(), rb_str_set_len(), rb_str_tmp_new(), rb_usascii_encindex, RSTRING_LEN, RSTRING_PTR, str, and StringValueCStr.

## ◆ rb_is_absolute_path()

int rb_is_absolute_path | ( | const char * | path | ) |

Definition at line 6177 of file file.c.

References isdirsep.

Referenced by rb_file_expand_path_internal(), rb_find_file(), and rb_find_file_ext().

## ◆ rb_str_encode_ospath()

VALUE rb_str_encode_ospath | ( | VALUE | path | ) |

Definition at line 251 of file file.c.

References ENCINDEX_ASCII, ENCINDEX_UTF_8, ENCODING_GET, rb_enc_from_index(), rb_filesystem_encindex(), rb_str_conv_enc(), and rb_utf8_encoding().

Referenced by rb_execarg_addopt(), rb_file_expand_path_internal(), and rb_resolve_feature_path().