gio-tool: add a "default-modified-time" option

As with `default-permissions` option, this overrides the `perserve`
option.
This commit is contained in:
Khalid Abu Shawarib 2023-10-13 03:53:24 +03:00
parent db01c11540
commit c70b8a7500

View File

@ -40,6 +40,7 @@ static gboolean preserve = FALSE;
static gboolean backup = FALSE;
static gboolean no_dereference = FALSE;
static gboolean default_permissions = FALSE;
static gboolean default_modified_time = FALSE;
static const GOptionEntry entries[] = {
{ "no-target-directory", 'T', 0, G_OPTION_ARG_NONE, &no_target_directory, N_("No target directory"), NULL },
@ -49,6 +50,7 @@ static const GOptionEntry entries[] = {
{ "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("Backup existing destination files"), NULL },
{ "no-dereference", 'P', 0, G_OPTION_ARG_NONE, &no_dereference, N_("Never follow symbolic links"), NULL },
{ "default-permissions", 0, 0, G_OPTION_ARG_NONE, &default_permissions, N_("Use default permissions for the destination"), NULL },
{ "default-modified-time", 0, 0, G_OPTION_ARG_NONE, &default_modified_time, N_("Use default file modification timestamps for the destination"), NULL },
G_OPTION_ENTRY_NULL
};
@ -181,6 +183,8 @@ handle_copy (int argc, char *argv[], gboolean do_help)
flags |= G_FILE_COPY_ALL_METADATA;
if (default_permissions)
flags |= G_FILE_COPY_TARGET_DEFAULT_PERMS;
if (default_modified_time)
flags |= G_FILE_COPY_TARGET_DEFAULT_MODIFIED_TIME;
error = NULL;
start_time = g_get_monotonic_time ();