glocalfileinfo: implement _g_stat_{a,c,m}_nsec for macOS

add implementations for these functions using st_{a,c,m}timespec when
__APPLE__ is defined. Also re-enable the g-file-info test for darwin.

Fixes #3070, #2608
This commit is contained in:
André Barnabá Silva
2025-10-20 22:30:49 -03:00
parent 07736dc3d2
commit 9222f71753
2 changed files with 5 additions and 2 deletions

View File

@@ -332,6 +332,10 @@ inline static guint32 _g_stat_mtim_nsec (const GLocalFileStat *buf) { return b
inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return buf->st_atimensec; } inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return buf->st_atimensec; }
inline static guint32 _g_stat_ctim_nsec (const GLocalFileStat *buf) { return buf->st_ctimensec; } inline static guint32 _g_stat_ctim_nsec (const GLocalFileStat *buf) { return buf->st_ctimensec; }
inline static guint32 _g_stat_mtim_nsec (const GLocalFileStat *buf) { return buf->st_mtimensec; } inline static guint32 _g_stat_mtim_nsec (const GLocalFileStat *buf) { return buf->st_mtimensec; }
#elif defined(__APPLE__)
inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return buf->st_atimespec.tv_nsec; }
inline static guint32 _g_stat_ctim_nsec (const GLocalFileStat *buf) { return buf->st_ctimespec.tv_nsec; }
inline static guint32 _g_stat_mtim_nsec (const GLocalFileStat *buf) { return buf->st_mtimespec.tv_nsec; }
#else #else
inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return 0; } inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return 0; }
inline static guint32 _g_stat_ctim_nsec (const GLocalFileStat *buf) { return 0; } inline static guint32 _g_stat_ctim_nsec (const GLocalFileStat *buf) { return 0; }

View File

@@ -85,9 +85,8 @@ gio_tests = {
}, },
'g-file' : {}, 'g-file' : {},
'g-file-info' : { 'g-file-info' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3070
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148 # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/3148
'can_fail' : host_system in ['darwin', 'gnu'] or host_system == 'windows' and cc.get_id() != 'gcc', 'can_fail' : host_system in ['gnu'] or host_system == 'windows' and cc.get_id() != 'gcc',
}, },
'g-icon' : {}, 'g-icon' : {},
'gdbus-addresses' : {}, 'gdbus-addresses' : {},