Pokemon - Ruby Version (U). Class : Dir - Ruby 2.3.0. Home; Core; Std-lib; Downloads. The directory used in these examples contains the two regular files (config.h and main.rb). Ruby 2.0.0-p648 (x64) Other Useful Downloads 7-Zip Archives. Ruby 2.2.4; Ruby 2.2.4. If you would like to use the 7-Zip archived versions or the Ruby documentation. Hi, I am looking at copying a folder and its contents from one destination to another. FileUtils.copy('C:/rspec_reports/javascripts', 'C:/rspec_reports/ javascripts. Class: Dir (Ruby 2. Dir[ string [, string ..] ] → arrayclick to toggle source. Equivalent to calling Dir. VALUE. dir_s_aref(int argc, VALUE *argv, VALUE obj). Object. Changes the current working directory of the process to the given string. When called without an argument, changes the directory to the value of the. HOME, or LOGDIR. System. Call. Error (probably Errno: :ENOENT) if the. As basic as this seems, I simply can't manage to copy the contents of one file to another. Here is my code thus far: #!/usr/bin/ruby Dir.chdir( '/mnt/Shared/minecraft. ZipFile is modeled after java.util.zip.ZipFile from the Java SDK. The most important methods are those inherited from ZipCentralDirectory for accessing information. Download the Pokemon - Ruby Version (U) ROM for Gameboy Advance (GBA). Region: United States of America. Works with Android, PC, Mac devices. If a block is given, it is passed the name of the new current directory. The original. working directory is restored when the block exits. The return value of. Dir. chdir("/var/spool/mail"). Dir. pwd. Dir. chdir("/tmp") doputs. Dir. pwd. Dir. chdir("/usr") doputs. Dir. pwdendputs. Dir. Dir. pwdproduces: /var/spool/mail. VALUE. dir_s_chdir(int argc, VALUE *argv, VALUE obj). VALUE path = Qnil. File. Path. Value(path). HOME"). if (! dist) {. LOGDIR"). if (! dist) rb_raise(rb_e. Arg. Error, "HOME/LOGDIR not set"). FALSE. return rb_ensure(chdir_yield, (VALUE)& args, chdir_restore, (VALUE)& args). INT2. FIX(0). chroot( string ) → 0click to toggle source. Changes this process’s idea of the file system root. Only a privileged. Not available on all platforms. On Unix. systems, see chroot(2) for more information. VALUE. dir_s_chroot(VALUE dir, VALUE path). RSTRING_PTR(path)) == - 1). INT2. FIX(0). delete( string ) → 0click to toggle source. Deletes the named directory. Raises a subclass of. System. Call. Error if the directory isn’t empty. VALUE. dir_s_rmdir(VALUE obj, VALUE dir). RSTRING_PTR(dir)) < 0). INT2. FIX(0). entries( dirname ) → arrayclick to toggle sourceentries( dirname, encoding: enc ) → array. Returns an array containing all of the filenames in the given directory. Will raise a System. Call. Error if the named directory doesn’t. The optional enc argument specifies the encoding of the directory. If not specified, the filesystem encoding is used. Dir. entries("testdir"). VALUE. dir_entries(int argc, VALUE *argv, VALUE io). Array, dir, dir_close, dir). Returns true if the named file is a directory. VALUE. rb_file_directory_p(void). Deprecated method. Don’t use. static VALUE. VALUE obj, VALUE fname). Dir. exists? is a deprecated name, use Dir. Calls the block once for each entry in the named directory, passing the. If no block is given, an enumerator is returned instead. Dir. foreach("testdir") {|x|puts"Got #{x}" }. VALUE. dir_foreach(int argc, VALUE *argv, VALUE io). RETURN_ENUMERATOR(io, argc, argv). Qnil. getwd → stringclick to toggle source. Returns the path to the current working directory of this process as a. Dir. chdir("/tmp") Dir. Dir. pwd. static VALUE. VALUE dir). return rb_dir_getwd(). Expands pattern, which is an Array of. String, and returns the. Note that this pattern is not a regexp, it’s closer to a shell glob. See. File. fnmatch for the meaning of. Note that case sensitivity depends on. File: :FNM_CASEFOLD is ignored), as does the order in which. Matches any file. Can be restricted by other values in the glob. Equivalent. to / .* /x in regexp.*Matches all filesc*Matches all files beginning with c*c. Matches all files ending with c*c*Match all files that have c in them (including at the. Note, this will not match Unix- like hidden files (dotfiles). In order to. include those in the match results, you must use the File: :FNM_DOTMATCH. Matches directories recursively.? Matches any one character. Equivalent to /.{1}/ in regexp.[set]Matches any one character in set. Behaves exactly like. Regexp, including set negation. Matches either literal p or literal q. Equivalent. to pattern alternation in regexp. Matching literals may be more than one character in length. More than two. literals may be specified. Escapes the next metacharacter. Note that this means you cannot use backslash on windows as part of a glob. Dir["c: \foo*"] will not work, use. Dir["c: /foo*"] instead. Examples: Dir["config.?"] Dir. Dir. glob("*.[a- z][a- z]") Dir. Dir. glob("*.{rb,h}") Dir. Dir. glob("*", File: :FNM_DOTMATCH) rbfiles = File. Dir. glob(rbfiles) libdirs = File. Dir. glob(libdirs) librbfiles = File. Dir. glob(librbfiles) librbfiles = File. Dir. glob(librbfiles). VALUE. dir_s_glob(int argc, VALUE *argv, VALUE obj). VALUE str, rflags, ary. NUM2. INT(rflags). NIL_P(ary)) {. ary = rb_push_glob(str, flags). VALUE v = ary. ary = dir_globs(RARRAY_LEN(v), RARRAY_CONST_PTR(v), flags). RB_GC_GUARD(v). if (rb_block_given_p()) {. Qnil. return ary. Returns the home directory of the current user or the named user if given. VALUE. dir_s_home(int argc, VALUE *argv, VALUE obj). VALUE user. const char *u = 0. Qnil. if (! NIL_P(user)) {. Safe. String. Value(user). String. Value. CStr(user). Makes a new directory named by string, with permissions specified. Integer. The permissions may be. File: :umask, and are ignored on NT. Raises a System. Call. Error if the directory cannot be created. See also the discussion of permissions in the class documentation for. File. Dir. mkdir(File. Dir. home, ". foo"), 0. VALUE. dir_s_mkdir(int argc, VALUE *argv, VALUE obj). VALUE path, vmode. NUM2. INT(vmode). RSTRING_PTR(path), mode) == - 1). INT2. FIX(0). new( string ) → a. Dirclick to toggle sourcenew( string, encoding: enc ) → a. Dir. Returns a new directory object for the named directory. The optional enc argument specifies the encoding of the directory. If not specified, the filesystem encoding is used. VALUE. dir_initialize(int argc, VALUE *argv, VALUE dir). VALUE dirname, opt, orig. ID keyword_ids[1]. NIL_P(opt)) {. VALUE enc. Qundef & & ! NIL_P(enc)) {. fsenc = rb_to_encoding(enc). Glob. Path. Value(dirname, FALSE). Typed. Data_Get_Struct(dir, struct dir_data, & dir_data_type, dp). NULL. dp- > path = Qnil. RSTRING_PTR(dirname). NULL) {. if (rb_gc_for_fd(errno)) {. HAVE_GETATTRLIST. EIO) {. u_int. 32_t attrbuf[1]. ATTR_BIT_MAP_COUNT, 0}. FSOPT_NOFOLLOW) == 0) {. NULL) {. RB_GC_GUARD(dirname). Dirclick to toggle sourceopen( string, encoding: enc ) → a. Diropen( string ) {| a. Dir | block } → an. Objectopen( string, encoding: enc ) {| a. Dir | block } → an. Object. The optional enc argument specifies the encoding of the directory. If not specified, the filesystem encoding is used. With no block, open is a synonym for Dir: :new. If. a block is present, it is passed a. Dir as a parameter. The. directory is closed at the end of the block, and Dir: :open. VALUE. dir_s_open(int argc, VALUE *argv, VALUE klass). VALUE dir = Typed. Data_Make_Struct(klass, struct dir_data, & dir_data_type, dp). Returns the path to the current working directory of this process as a. Dir. chdir("/tmp") Dir. Dir. pwd. static VALUE. VALUE dir). return rb_dir_getwd(). Deletes the named directory. Raises a subclass of. System. Call. Error if the directory isn’t empty. VALUE. dir_s_rmdir(VALUE obj, VALUE dir). RSTRING_PTR(dir)) < 0). INT2. FIX(0). unlink( string ) → 0click to toggle source. Deletes the named directory. Raises a subclass of. System. Call. Error if the directory isn’t empty. VALUE. dir_s_rmdir(VALUE obj, VALUE dir). RSTRING_PTR(dir)) < 0). INT2. FIX(0). close → nilclick to toggle source. Closes the directory stream. Any further attempts to access dir. IOError. d = Dir. VALUE. dir_close(VALUE dir). Qnil. closedir(dirp- > dir). NULL. return Qnil. Calls the block once for each entry in this directory, passing the filename. If no block is given, an enumerator is returned instead. Dir. new("testdir"). Got #{x}" }. static VALUE. VALUE dir). struct dir_data *dirp. IF_NORMALIZE_UTF8. PATH(int norm_p). RETURN_ENUMERATOR(dir, 0, 0). Get. DIR(dir, dirp). IF_NORMALIZE_UTF8. PATH(norm_p = need_normalization(dirp- > dir, RSTRING_PTR(dirp- > path))). READDIR(dirp- > dir, dirp- > enc)) != NULL) {. NAMLEN(dp). VALUE path. NORMALIZE_UTF8. PATH. NIL_P(path = rb_str_normalize_ospath(name, namlen))) {. NULL) dir_closed(). Returns the file descriptor used in dir. Dir. new("."). d. This method uses dirfd() function defined by POSIX 2. Not. Implemented. Error is raised on other. Windows, which doesn’t provide the function. VALUE. dir_fileno(VALUE dir). Get. DIR(dir, dirp). INT2. NUM(fd). inspect → stringclick to toggle source. Return a string describing this Dir object. VALUE. dir_inspect(VALUE dir). Typed. Data_Get_Struct(dir, struct dir_data, & dir_data_type, dirp). NIL_P(dirp- > path)) {. VALUE str = rb_str_new_cstr("#< "). CLASS_OF(dir))). rb_str_cat. Returns the path parameter passed to dir’s constructor. Dir. new("."). static VALUE. VALUE dir). struct dir_data *dirp. Typed. Data_Get_Struct(dir, struct dir_data, & dir_data_type, dirp). NIL_P(dirp- > path)) return Qnil. Returns the current position in dir. See also. Dir#seek. Dir. new("testdir"). VALUE. dir_tell(VALUE dir). Get. DIR(dir, dirp). Synonym for Dir#seek, but returns the position parameter. Dir. new("testdir") d. VALUE. dir_set_pos(VALUE dir, VALUE pos). Reads the next entry from dir and returns it as a string. Returns. nil at the end of the stream. Dir. new("testdir"). VALUE. dir_read(VALUE dir). Get. DIR(dir, dirp). READDIR(dirp- > dir, dirp- > enc)) != NULL) {. NAMLEN(dp), dirp- > enc). Qnil; /* end of stream */. Repositions dir to the first entry. Dir. new("testdir"). VALUE. dir_rewind(VALUE dir). Get. DIR(dir, dirp). Seeks to a particular location in dir. Dir#tell. d = Dir. VALUE. dir_seek(VALUE dir, VALUE pos). NUM2. LONG(pos). Get. DIR(dir, dirp). seekdir(dirp- > dir, p). Returns the current position in dir. See also. Dir#seek. Dir. new("testdir"). VALUE. dir_tell(VALUE dir). Get. DIR(dir, dirp). Returns the path parameter passed to dir’s constructor. Dir. new("."). static VALUE. VALUE dir). struct dir_data *dirp. Typed. Data_Get_Struct(dir, struct dir_data, & dir_data_type, dirp). NIL_P(dirp- > path)) return Qnil.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2016
Categories |