4 static VALUE rb_cPathname;
11 static ID id_binwrite;
12 static ID id_birthtime;
13 static ID id_blockdev_p;
14 static ID id_chardev_p;
18 static ID id_directory_p;
22 static ID id_executable_p;
23 static ID id_executable_real_p;
25 static ID id_expand_path;
33 static ID id_grpowned_p;
44 static ID id_readable_p;
45 static ID id_readable_real_p;
46 static ID id_readlines;
47 static ID id_readlink;
48 static ID id_realdirpath;
49 static ID id_realpath;
52 static ID id_setgid_p;
53 static ID id_setuid_p;
56 static ID id_socket_p;
59 static ID id_sticky_p;
62 static ID id_symlink_p;
65 static ID id_truncate;
68 static ID id_world_readable_p;
69 static ID id_world_writable_p;
70 static ID id_writable_p;
71 static ID id_writable_real_p;
76 get_strpath(
VALUE obj)
112 set_strpath(
self, str);
126 path_freeze(
VALUE self)
142 path_taint(
VALUE self)
158 path_untaint(
VALUE self)
175 return rb_str_equal(get_strpath(
self), get_strpath(other));
200 s1 = get_strpath(
self);
201 s2 = get_strpath(other);
206 while (p1 < e1 && p2 < e2) {
208 c1 = (
unsigned char)*p1++;
209 c2 = (
unsigned char)*p2++;
210 if (c1 ==
'/') c1 =
'\0';
211 if (c2 ==
'/') c2 =
'\0';
227 #define ST2FIX(h) LONG2FIX((long)(h)) 232 path_hash(
VALUE self)
247 path_to_s(
VALUE self)
254 path_inspect(
VALUE self)
257 VALUE str = get_strpath(
self);
271 VALUE str = get_strpath(
self);
293 VALUE str = get_strpath(
self);
306 else if (extlen <= 1) {
328 path_realpath(
int argc,
VALUE *argv,
VALUE self)
344 path_realdirpath(
int argc,
VALUE *argv,
VALUE self)
363 path_each_line(
int argc,
VALUE *argv,
VALUE self)
368 args[0] = get_strpath(
self);
369 n =
rb_scan_args(argc, argv,
"03", &args[1], &args[2], &args[3]);
394 args[0] = get_strpath(
self);
395 n =
rb_scan_args(argc, argv,
"03", &args[1], &args[2], &args[3]);
409 path_binread(
int argc,
VALUE *argv,
VALUE self)
414 args[0] = get_strpath(
self);
435 args[0] = get_strpath(
self);
436 n =
rb_scan_args(argc, argv,
"03", &args[1], &args[2], &args[3]);
451 path_binwrite(
int argc,
VALUE *argv,
VALUE self)
456 args[0] = get_strpath(
self);
457 n =
rb_scan_args(argc, argv,
"03", &args[1], &args[2], &args[3]);
473 path_readlines(
int argc,
VALUE *argv,
VALUE self)
478 args[0] = get_strpath(
self);
479 n =
rb_scan_args(argc, argv,
"03", &args[1], &args[2], &args[3]);
491 path_sysopen(
int argc,
VALUE *argv,
VALUE self)
496 args[0] = get_strpath(
self);
510 path_atime(
VALUE self)
515 #if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC) || defined(_WIN32) 531 # define path_birthtime rb_f_notimplement 543 path_ctime(
VALUE self)
557 path_mtime(
VALUE self)
628 path_fnmatch(
int argc,
VALUE *argv,
VALUE self)
630 VALUE str = get_strpath(
self);
631 VALUE pattern, flags;
632 if (
rb_scan_args(argc, argv,
"11", &pattern, &flags) == 1)
647 path_ftype(
VALUE self)
677 args[0] = get_strpath(
self);
678 n =
rb_scan_args(argc, argv,
"03", &args[1], &args[2], &args[3]);
693 path_readlink(
VALUE self)
717 path_stat(
VALUE self)
726 path_lstat(
VALUE self)
773 path_basename(
int argc,
VALUE *argv,
VALUE self)
775 VALUE str = get_strpath(
self);
790 path_dirname(
VALUE self)
792 VALUE str = get_strpath(
self);
803 path_extname(
VALUE self)
805 VALUE str = get_strpath(
self);
815 path_expand_path(
int argc,
VALUE *argv,
VALUE self)
817 VALUE str = get_strpath(
self);
832 path_split(
VALUE self)
834 VALUE str = get_strpath(
self);
835 VALUE ary, dirname, basename;
849 path_blockdev_p(
VALUE self)
858 path_chardev_p(
VALUE self)
867 path_executable_p(
VALUE self)
876 path_executable_real_p(
VALUE self)
885 path_exist_p(
VALUE self)
894 path_grpowned_p(
VALUE self)
903 path_directory_p(
VALUE self)
912 path_file_p(
VALUE self)
921 path_pipe_p(
VALUE self)
930 path_socket_p(
VALUE self)
939 path_owned_p(
VALUE self)
948 path_readable_p(
VALUE self)
957 path_world_readable_p(
VALUE self)
966 path_readable_real_p(
VALUE self)
975 path_setuid_p(
VALUE self)
984 path_setgid_p(
VALUE self)
993 path_size(
VALUE self)
1002 path_size_p(
VALUE self)
1011 path_sticky_p(
VALUE self)
1020 path_symlink_p(
VALUE self)
1029 path_writable_p(
VALUE self)
1038 path_world_writable_p(
VALUE self)
1047 path_writable_real_p(
VALUE self)
1056 path_zero_p(
VALUE self)
1067 path_empty_p(
VALUE self)
1070 VALUE path = get_strpath(
self);
1092 path_s_glob(
int argc,
VALUE *argv,
VALUE klass)
1097 n =
rb_scan_args(argc, argv,
"11", &args[0], &args[1]);
1137 n =
rb_scan_args(argc, argv,
"11", &args[0], &args[1]);
1172 path_s_getwd(
VALUE klass)
1206 path_entries(
VALUE self)
1208 VALUE klass, str, ary;
1211 str = get_strpath(
self);
1228 path_mkdir(
int argc,
VALUE *argv,
VALUE self)
1230 VALUE str = get_strpath(
self);
1244 path_rmdir(
VALUE self)
1255 path_opendir(
VALUE self)
1259 args[0] = get_strpath(
self);
1274 path_each_entry(
VALUE self)
1278 args[0] = get_strpath(
self);
1283 unlink_body(
VALUE str)
1299 path_unlink(
VALUE self)
1302 VALUE str = get_strpath(
self);
1303 return rb_rescue2(unlink_body, str, unlink_rescue, str, eENOTDIR, (
VALUE)0);
1565 rb_define_method(rb_cPathname,
"executable_real?", path_executable_real_p, 0);
1574 rb_define_method(rb_cPathname,
"world_readable?", path_world_readable_p, 0);
1583 rb_define_method(rb_cPathname,
"world_writable?", path_world_writable_p, 0);
1620 id_directory_p =
rb_intern(
"directory?");
1624 id_executable_p =
rb_intern(
"executable?");
1625 id_executable_real_p =
rb_intern(
"executable_real?");
1627 id_expand_path =
rb_intern(
"expand_path");
1647 id_readable_real_p =
rb_intern(
"readable_real?");
1650 id_realdirpath =
rb_intern(
"realdirpath");
1669 id_world_readable_p =
rb_intern(
"world_readable?");
1670 id_world_writable_p =
rb_intern(
"world_writable?");
1672 id_writable_real_p =
rb_intern(
"writable_real?");
VALUE rb_ary_entry(VALUE ary, long offset)
VALUE rb_str_equal(VALUE str1, VALUE str2)
void InitVM_pathname(void)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
int rb_block_given_p(void)
Determines if the current method is given a block.
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
VALUE rb_obj_dup(VALUE)
call-seq: obj.dup -> an_object
VALUE rb_ivar_get(VALUE, ID)
st_index_t rb_str_hash(VALUE)
VALUE rb_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
void rb_define_global_function(const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a global function.
void rb_undef_method(VALUE klass, const char *name)
VALUE rb_rescue2(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*r_proc)(ANYARGS), VALUE data2,...)
An equivalent of rescue clause.
const char * rb_obj_classname(VALUE)
#define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)
VALUE rb_obj_class(VALUE)
call-seq: obj.class -> class
#define RB_TYPE_P(obj, type)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
call-seq: obj.is_a?(class) -> true or false obj.kind_of?(class) -> true or false
VALUE rb_obj_taint(VALUE)
call-seq: obj.taint -> obj
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
RUBY_EXTERN VALUE rb_cObject
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
void rb_ary_store(VALUE ary, long idx, VALUE val)
VALUE rb_str_subseq(VALUE, long, long)
VALUE rb_sprintf(const char *format,...)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
VALUE rb_ivar_set(VALUE, ID, VALUE)
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
VALUE rb_call_super(int, const VALUE *)
VALUE rb_str_freeze(VALUE)
rb_encoding * rb_enc_get(VALUE obj)
#define RARRAY_AREF(a, i)
VALUE rb_check_array_type(VALUE ary)
VALUE rb_convert_type(VALUE, int, const char *, const char *)
Converts an object into another type.
VALUE rb_class_new_instance(int, const VALUE *, VALUE)
Allocates and initializes an instance of klass.
VALUE rb_obj_untaint(VALUE)
call-seq: obj.untaint -> obj
VALUE rb_const_get_at(VALUE, ID)
const char * ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_str_append(VALUE, VALUE)