[glib: 1/5] W32: set nlink, clarify comments



commit c2a5537845807df500c800454230c22805bf4ba8
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Fri Aug 24 08:43:46 2018 +0000

    W32: set nlink, clarify comments
    
    The st_nlink field of the stat structure has meaning and should
    be put into GFileInfo.
    
    The st_mode field is far less meaningful, but could still be used
    for some purposes, adjust the comment to clarify that.

 gio/glocalfileinfo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index ed7e99400..e2f38c880 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -966,15 +966,17 @@ set_info_from_stat (GFileInfo             *info,
   g_file_info_set_size (info, statbuf->st_size);
 
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_DEVICE, statbuf->st_dev);
+  _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_NLINK, statbuf->st_nlink);
 #ifndef G_OS_WIN32
   /* Pointless setting these on Windows even if they exist in the struct */
   _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_INODE, statbuf->st_ino);
-  _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_NLINK, statbuf->st_nlink);
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_UID, statbuf->st_uid);
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_GID, statbuf->st_gid);
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_RDEV, statbuf->st_rdev);
 #endif
-  /* FIXME: st_mode is mostly pointless on Windows, too. Set the attribute or not? */
+  /* Mostly pointless on Windows.
+   * Still, it allows for S_ISREG/S_ISDIR and IWRITE (read-only) checks.
+   */
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_MODE, statbuf->st_mode);
 #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE)
   _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_BLOCK_SIZE, statbuf->st_blksize);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]