Created
September 23, 2015 09:22
-
-
Save vjdhama/ba30a922909620a65cf5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns a File::Stat object for the named file or raises | |
# `Errno::ENOENT` (See `File::Stat`) | |
# | |
# ``` | |
# echo "foo" > foo | |
# File.stat("foo").size #=> 4 | |
# File.stat("foo").mtime #=> 2015-09-23 06:24:19 UTC | |
# ``` | |
def self.lstat(path) | |
if LibC.lstat(path, out stat) != 0 | |
raise Errno.new("Unable to get lstat for '#{path}'") | |
end | |
Stat.new(stat) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment