Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
b766af16 by Felix Paul Kühne at 2026-05-28T15:07:47+02:00
macosx: update 'Date Last Opened' datapoint for opened media
It respects the same option as for keeping recently opened media in the
menu. Likewise, the date is currently not updated for media opened from
within the media library.
This fixes #22738
- - - - -
1 changed file:
- modules/gui/macosx/playqueue/VLCPlayQueueController.m
Changes:
=====================================
modules/gui/macosx/playqueue/VLCPlayQueueController.m
=====================================
@@ -35,6 +35,9 @@
#import "windows/VLCOpenInputMetadata.h"
#import "library/VLCInputItem.h"
+#include <sys/xattr.h>
+#include <time.h>
+
NSString * const VLCPlaybackOrderChanged = @"VLCPlaybackOrderChanged";
NSString * const VLCPlaybackRepeatChanged = @"VLCPlaybackRepeatChanged";
NSString * const VLCPlaybackHasPreviousChanged =
@"VLCPlaybackHasPreviousChanged";
@@ -628,6 +631,20 @@ static const struct vlc_playlist_callbacks
playlist_callbacks = {
#pragma mark - helper methods
+- (void)updateLastOpenedDate:(NSURL *)url
+{
+ if (!url.isFileURL) {
+ return;
+ }
+
+ struct timespec ts;
+ if (clock_gettime(CLOCK_REALTIME, &ts) != 0) {
+ return;
+ }
+
+ setxattr(url.fileSystemRepresentation, "com.apple.lastuseddate#PS", &ts,
sizeof(ts), 0, 0);
+}
+
- (input_item_t *)createInputItemBasedOnMetadata:(VLCOpenInputMetadata
*)itemMetadata
{
intf_thread_t *p_intf = getIntf();
@@ -690,8 +707,10 @@ static const struct vlc_playlist_callbacks
playlist_callbacks = {
}
/* Recent documents menu */
- if (url != nil && var_InheritBool(getIntf(), "macosx-recentitems"))
+ if (url != nil && var_InheritBool(getIntf(), "macosx-recentitems")) {
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL:url];
+ [self updateLastOpenedDate:url];
+ }
/* Recent Streams menu */
if (url != nil && !url.isFileURL) {
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/b766af16a3f43f02491b7d12d6527eb4d736a283
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/b766af16a3f43f02491b7d12d6527eb4d736a283
You're receiving this email because of your account on code.videolan.org.
Manage all notifications: https://code.videolan.org/-/profile/notifications |
Help: https://code.videolan.org/help
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits