Merge branch 'issue-1452' into 'master'
Issue 1452
Closes #1452
See merge request GNOME/glib!235
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index b3e2937..9cf7ff8 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -961,7 +961,8 @@
else if (S_ISLNK (statbuf->st_mode))
file_type = G_FILE_TYPE_SYMBOLIC_LINK;
#elif defined (G_OS_WIN32)
- if (statbuf->reparse_tag == IO_REPARSE_TAG_SYMLINK)
+ if (statbuf->reparse_tag == IO_REPARSE_TAG_SYMLINK ||
+ statbuf->reparse_tag == IO_REPARSE_TAG_MOUNT_POINT)
file_type = G_FILE_TYPE_SYMBOLIC_LINK;
#endif
@@ -1005,13 +1006,20 @@
#elif defined (HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC)
_g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_ACCESS_USEC, statbuf->st_atim.tv_nsec / 1000);
#endif
-
+
+#ifndef G_OS_WIN32
+ /* Microsoft uses st_ctime for file creation time,
+ * instead of file change time:
+ * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions#generic-text-routine-mappings
+ * Thank you, Microsoft!
+ */
_g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CHANGED, statbuf->st_ctime);
#if defined (HAVE_STRUCT_STAT_ST_CTIMENSEC)
_g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CHANGED_USEC, statbuf->st_ctimensec / 1000);
#elif defined (HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC)
_g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CHANGED_USEC, statbuf->st_ctim.tv_nsec / 1000);
#endif
+#endif
#if defined (HAVE_STRUCT_STAT_ST_BIRTHTIME) && defined (HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC)
_g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CREATED, statbuf->st_birthtime);
@@ -1023,6 +1031,8 @@
_g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CREATED, statbuf->st_birthtime);
#elif defined (HAVE_STRUCT_STAT_ST_BIRTHTIM)
_g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CREATED, statbuf->st_birthtim);
+#elif defined (G_OS_WIN32)
+ _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CREATED, statbuf->st_ctime);
#endif
if (_g_file_attribute_matcher_matches_id (attribute_matcher,
@@ -1799,7 +1809,9 @@
is_symlink = stat_ok && S_ISLNK (statbuf.st_mode);
#elif defined (G_OS_WIN32)
/* glib already checked the FILE_ATTRIBUTE_REPARSE_POINT for us */
- is_symlink = stat_ok && statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK;
+ is_symlink = stat_ok &&
+ (statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK ||
+ statbuf.reparse_tag == IO_REPARSE_TAG_MOUNT_POINT);
#else
is_symlink = FALSE;
#endif
@@ -2182,7 +2194,9 @@
GWin32PrivateStat statbuf;
res = GLIB_PRIVATE_CALL (g_win32_lstat_utf8) (filename, &statbuf);
- is_symlink = (res == 0 && statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK);
+ is_symlink = (res == 0 &&
+ (statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK ||
+ statbuf.reparse_tag == IO_REPARSE_TAG_MOUNT_POINT));
#endif
if (is_symlink)
{