Created
January 11, 2014 16:56
-
-
Save Varriount/8373418 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
proc getFileInfo(path: string, followSymlinks:true): FileInfo = | |
## Retrieve the metadata associated with file system object pointed | |
## to by `path` . | |
when defined(Windows): | |
var openFlags = FILE_ATTRIBUTE_NORMAL | |
if followSymlinks: | |
openFlags = (openFlags or FILE_FLAG_OPEN_REPARSE_POINT) | |
var handle = createFileW(path, 0'i32, 0'i32, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) | |
if handle != INVALID_HANDLE_VALUE: | |
var fileInfo = getFileInfo(handle) | |
discard closeHandle(handle) | |
else: | |
osError(osLastError()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment