S
Simon Strandgaard
File.stat(name).symlink? keeps returning false, even though
I do stat on a real symlink file.
Shouldn't symlink? return true in on the 'xyzxyzxyz'..
see attached snippet
--
Simon Strandgaard
server> ruby a.rb
filename=/usr/home/neoneye/kode/editor/projects/regexp_engine/test/a.rb
symlink?=false
type=file
#<File::Stat dev=0x413, ino=456591, mode=0100644, nlink=1, uid=1001, gid=1001, rdev=0x1bab02, size=358, blksize=16384, blocks=4, atime=Sun Apr 11 00:51:15 CEST 2004, mtime=Sun Apr 11 00:48:50 CEST 2004, ctime=Sun Apr 11 00:48:50 CEST 2004>
----------------------------------------
filename=xyzxyzxyz
symlink?=false
type=link
#<File::Stat dev=0x413, ino=456591, mode=0100644, nlink=1, uid=1001, gid=1001, rdev=0x1bab02, size=358, blksize=16384, blocks=4, atime=Sun Apr 11 00:51:15 CEST 2004, mtime=Sun Apr 11 00:48:50 CEST 2004, ctime=Sun Apr 11 00:48:50 CEST 2004>
server> expand -t2 a.rb
require 'fileutils'
def info(name)
stat = File.stat(name)
ftype = File.ftype(name)
issym = File.stat(name).symlink?
puts "filename=#{name}\nsymlink?=#{issym}\ntype=#{ftype}\n#{stat.inspect}"
end
absname = File.expand_path(__FILE__)
linkname = "xyzxyzxyz"
FileUtils.ln_s(absname, linkname)
info(absname)
puts("-"*40)
info(linkname)
FileUtils.rm(linkname)
server>
I do stat on a real symlink file.
Shouldn't symlink? return true in on the 'xyzxyzxyz'..
see attached snippet
--
Simon Strandgaard
server> ruby a.rb
filename=/usr/home/neoneye/kode/editor/projects/regexp_engine/test/a.rb
symlink?=false
type=file
#<File::Stat dev=0x413, ino=456591, mode=0100644, nlink=1, uid=1001, gid=1001, rdev=0x1bab02, size=358, blksize=16384, blocks=4, atime=Sun Apr 11 00:51:15 CEST 2004, mtime=Sun Apr 11 00:48:50 CEST 2004, ctime=Sun Apr 11 00:48:50 CEST 2004>
----------------------------------------
filename=xyzxyzxyz
symlink?=false
type=link
#<File::Stat dev=0x413, ino=456591, mode=0100644, nlink=1, uid=1001, gid=1001, rdev=0x1bab02, size=358, blksize=16384, blocks=4, atime=Sun Apr 11 00:51:15 CEST 2004, mtime=Sun Apr 11 00:48:50 CEST 2004, ctime=Sun Apr 11 00:48:50 CEST 2004>
server> expand -t2 a.rb
require 'fileutils'
def info(name)
stat = File.stat(name)
ftype = File.ftype(name)
issym = File.stat(name).symlink?
puts "filename=#{name}\nsymlink?=#{issym}\ntype=#{ftype}\n#{stat.inspect}"
end
absname = File.expand_path(__FILE__)
linkname = "xyzxyzxyz"
FileUtils.ln_s(absname, linkname)
info(absname)
puts("-"*40)
info(linkname)
FileUtils.rm(linkname)
server>