summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorClay Sweetser <clay.sweetser@gmail.com>2014-04-15 02:28:50 -0400
committerClay Sweetser <clay.sweetser@gmail.com>2014-04-16 03:35:08 -0400
commit73570cbe38e46362210ab829100f13429c90eef0 (patch)
tree98d0cf68b313868f7f2bf6ff1294a8fc4d38c96e /lib/pure
parent79f0c66b4de25d5b75d729106f7b6f80835ca0ac (diff)
downloadNim-73570cbe38e46362210ab829100f13429c90eef0.tar.gz
Allowed getFileInfo to accept TFile objects.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/os.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index bfc63dfc6..30a5ae949 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1828,7 +1828,7 @@ template rawToFormalFileInfo(rawInfo, formalInfo): expr =
     if S_ISDIR(rawInfo.st_mode): formalInfo.kind = pcDir
     if S_ISLNK(rawInfo.st_mode): formalInfo.kind.inc()
 
-proc getFileInfo*(handle: TFileHandle, result: var FileInfo) =
+proc getFileInfo*(handle: TFileHandle): FileInfo =
   ## Retrieves file information for the file object represented by the given
   ## handle.
   ##
@@ -1849,6 +1849,9 @@ proc getFileInfo*(handle: TFileHandle, result: var FileInfo) =
       osError(osLastError())
     rawToFormalFileInfo(rawInfo, result)
 
+proc getFileInfo*(file: TFile): FileInfo =
+  result = getFileInfo(file.fileHandle())
+
 proc getFileInfo*(path: string, followSymlink = true): FileInfo =
   ## Retrieves file information for the file object pointed to by `path`.
   ##