T
Trans
What happens when you use FileUtils.ln on a Windows system. Does it
fail? Is that why Jim Weirich uses #safe_ln, eg.
LINKING_SUPPORTED = [true]
# Attempt to do a normal file link, but fall back
# to a copy if the link fails.
def safe_ln(*args)
unless LINKING_SUPPORTED[0]
cp(*args)
else
begin
ln(*args)
rescue Errno::EOPNOTSUPP
LINKING_SUPPORTED[0] = false
cp(*args)
end
end
end
If so, is there a better way? Or why wouldn't this be built into Ruby.
Thanks,
T.
fail? Is that why Jim Weirich uses #safe_ln, eg.
LINKING_SUPPORTED = [true]
# Attempt to do a normal file link, but fall back
# to a copy if the link fails.
def safe_ln(*args)
unless LINKING_SUPPORTED[0]
cp(*args)
else
begin
ln(*args)
rescue Errno::EOPNOTSUPP
LINKING_SUPPORTED[0] = false
cp(*args)
end
end
end
If so, is there a better way? Or why wouldn't this be built into Ruby.
Thanks,
T.