From 357261d054714b9b1469435f9bdb87a5294368c2 Mon Sep 17 00:00:00 2001 From: Johann Dubois Date: Wed, 29 Jan 2014 14:49:31 -0500 Subject: [PATCH 1/1] lib/file: Add comments in FileStat closes #234 signed-off-by: Johann Dubois --- lib/standard/file.nit | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/standard/file.nit b/lib/standard/file.nit index 9114ff1..561df93 100644 --- a/lib/standard/file.nit +++ b/lib/standard/file.nit @@ -362,20 +362,32 @@ redef class NativeString private fun file_chdir is extern "string_NativeString_NativeString_file_chdir_0" end -extern FileStat `{ struct stat * `} # This class is system dependent ... must reify the vfs +extern class FileStat `{ struct stat * `} + # Returns the permission bits of file fun mode: Int is extern "file_FileStat_FileStat_mode_0" + # Returns the last access time fun atime: Int is extern "file_FileStat_FileStat_atime_0" + # Returns the last status change time fun ctime: Int is extern "file_FileStat_FileStat_ctime_0" + # Returns the last modification time fun mtime: Int is extern "file_FileStat_FileStat_mtime_0" + # Returns the size fun size: Int is extern "file_FileStat_FileStat_size_0" + # Returns true if it is a regular file (not a device file, pipe, sockect, ...) fun is_reg: Bool `{ return S_ISREG(recv->st_mode); `} + # Returns true if it is a directory fun is_dir: Bool `{ return S_ISDIR(recv->st_mode); `} + # Returns true if it is a character device fun is_chr: Bool `{ return S_ISCHR(recv->st_mode); `} + # Returns true if it is a block device fun is_blk: Bool `{ return S_ISBLK(recv->st_mode); `} + # Returns true if the type is fifo fun is_fifo: Bool `{ return S_ISFIFO(recv->st_mode); `} + # Returns true if the type is a link fun is_lnk: Bool `{ return S_ISLNK(recv->st_mode); `} + # Returns true if the type is a socket fun is_sock: Bool `{ return S_ISSOCK(recv->st_mode); `} end -- 1.7.9.5