0
@@ -4,7 +4,7 @@ module Platform::POSIX
0
class TimeVal < FFI::Struct
0
config 'rbx.platform.timeval', :tv_sec, :tv_usec
0
@@ -61,7 +61,7 @@ class File < IO
0
private_class_method :dirsep?, :next_path, :range, :name_match
0
# these will be necessary when we run on Windows
0
const_set :DOSISH, RUBY_PLATFORM.match("mswin")
0
const_set :CASEFOLD_FILESYSTEM, DOSISH
0
@@ -96,7 +96,7 @@ class File < IO
0
def self.lchmod(mode, *paths)
0
mode = Type.coerce_to(mode, Integer, :to_int) unless mode.is_a? Integer
0
@@ -224,14 +224,14 @@ class File < IO
0
pathname = (flags & FNM_PATHNAME) != 0
0
period = (flags & FNM_DOTMATCH) == 0
0
nocase = (flags & FNM_CASEFOLD) != 0
0
while pstart < patend do
0
- if (index >= strend || (pathname && dirsep?(str[index])) ||
0
- (period && str[index] == ?. && (index == 0 ||
0
+ if (index >= strend || (pathname && dirsep?(str[index])) ||
0
+ (period && str[index] == ?. && (index == 0 ||
0
(pathname && dirsep?(str[index-1])))))
0
@@ -242,7 +242,7 @@ class File < IO
0
break unless char == ?*
0
- if (index < strend && (period && str[index] == ?. &&
0
+ if (index < strend && (period && str[index] == ?. &&
0
(index == 0 || (pathname && dirsep?(str[index-1])))))
0
@@ -274,7 +274,7 @@ class File < IO
0
- if (index >= strend || (pathname && dirsep?(str[index]) ||
0
+ if (index >= strend || (pathname && dirsep?(str[index]) ||
0
(period && str[index] == ?. && (index == 0 || (pathname && dirsep?(str[index-1]))))))
0
@@ -289,7 +289,7 @@ class File < IO
0
return false if index >= strend
0
if DOSISH && (pathname && isdirsep?(char) && dirsep?(str[index]))
0
# TODO: invert this boolean expression
0
@@ -302,10 +302,10 @@ class File < IO
0
index >= strend ? true : false
0
def self.fnmatch(pattern, path, flags=0)
0
pattern = StringValue(pattern).dup
0
path = StringValue(path).dup
0
@@ -318,7 +318,7 @@ class File < IO
0
def self.grpowned?(path)
0
@@ -344,13 +344,13 @@ class File < IO
0
cur_part = part.send(:remove_outer_arrays)
0
if cur_part.any?{ |e| e.__id__ == cur_part.__id__ }
0
cur_part = cur_part.dup
0
cur_part.send(:recursively_flatten,cur_part,clean_part,'[...]')
0
@@ -484,11 +484,11 @@ class File < IO
0
unless self.exist?(path)
0
raise Errno::ENOENT, path
0
unless length.respond_to?(:to_int)
0
raise TypeError, "can't convert #{length.class} into Integer"
0
n = POSIX.truncate(path, length)
0
Errno.handle if n == -1
0
@@ -563,7 +563,7 @@ class File < IO
0
mode = Type.coerce_to(mode, Integer, :to_int) unless mode.is_a? Integer
0
POSIX.fchmod(@descriptor, mode)
0
def chown(owner_int, group_int)
0
POSIX.fchown(@descriptor, owner_int || -1, group_int || -1)
0
@@ -571,7 +571,7 @@ class File < IO
0
def flock(locking_constant)
0
result = POSIX.flock(@descriptor, locking_constant)
0
return false if result == -1
0
@@ -581,26 +581,26 @@ class File < IO
0
length = Type.coerce_to(length, Integer, :to_int)
0
raise Errno::EINVAL, "Can't truncate a file to a negative length" if length < 0
0
raise IOError, "File is closed" if closed?
0
n = POSIX.ftruncate(@descriptor, length)
0
Errno.handle if n == -1
0
return_string = "#<#{self.class}:0x#{object_id.to_s(16)} path=#{@path}"
0
return_string << " (closed)" if closed?
0
@@ -640,7 +640,7 @@ class File::Stat
0
S_ISGID = Rubinius::RUBY_CONFIG['rbx.platform.file.S_ISGID']
0
POSIX = Platform::POSIX
0
def initialize(path, follow_links=true)
0
@path = StringValue path
0
@@ -651,25 +651,25 @@ class File::Stat
0
Errno.handle @path unless result == 0
0
def self.stat?(path, follow_links=true)
0
rescue Errno::ENOENT, Errno::ENOTDIR
0
Time.at @stat[:st_atime]
0
@stat[:st_mode] & S_IFMT == S_IFBLK
0
@@ -681,16 +681,16 @@ class File::Stat
0
Time.at @stat[:st_ctime]
0
major = POSIX.major @stat[:st_dev]
0
major < 0 ? nil : major
0
minor = POSIX.major @stat[:st_dev]
0
minor < 0 ? nil : minor
0
@@ -741,7 +741,7 @@ class File::Stat
0
@stat[:st_gid] == POSIX.getegid
0
@@ -749,7 +749,7 @@ class File::Stat
0
"#<File::Stat dev=0x#{self.dev.to_s(16)}, ino=#{self.ino}, " \
0
"mode=#{sprintf("%07d", self.mode.to_s(8).to_i)}, nlink=#{self.nlink}, " \
0
@@ -761,15 +761,15 @@ class File::Stat
0
Time.at @stat[:st_mtime]
0
@stat[:st_uid] == POSIX.geteuid
0
@@ -777,7 +777,7 @@ class File::Stat
0
@stat[:st_mode] & S_IFMT == S_IFIFO
0
@@ -785,17 +785,17 @@ class File::Stat
0
major = POSIX.major @stat[:st_rdev]
0
major < 0 ? nil : major
0
minor = POSIX.minor @stat[:st_rdev]
0
minor < 0 ? nil : minor
0
return true if superuser?
0
return @stat[:st_mode] & S_IRUSR != 0 if owned?
0
@@ -813,7 +813,7 @@ class File::Stat
0
@@ -829,7 +829,7 @@ class File::Stat
0
return true if superuser?
0
return @stat[:st_mode] & S_IWUSR != 0 if owned?
0
@@ -847,7 +847,7 @@ class File::Stat
0
return nil unless other.is_a?(File::Stat)
0
self.mtime <=> other.mtime
Comments
No one has commented yet.