screencast: Use the same format for screencasts and screenshot file names

Screenshots use `%Y-%m-%d %H-%M-%S` for the timestamp, which has the
advantage of allowing proper lexicographical sorting.

The screencast file name pattern, on the other hand, uses
locale-dependent expansions, which break sorting based on file name, and
introduces the chance of potentially invalid characters on different
file systems.

Fixes: #5115
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2300>
This commit is contained in:
Emmanuele Bassi 2022-05-20 17:40:35 +01:00 committed by Marge Bot
parent 6aa3a2f4e2
commit 317fa8222e

View File

@ -308,19 +308,17 @@ var ScreencastService = class extends ServiceImplementation {
break; break;
case 'd': { case 'd': {
const datetime = GLib.DateTime.new_now_local(); const datetime = GLib.DateTime.new_now_local();
const datestr = datetime.format('%0x'); const datestr = datetime.format('%Y-%m-%d');
const datestrEscaped = datestr.replace(/\//g, '-');
filename += datestrEscaped; filename += datestr;
break; break;
} }
case 't': { case 't': {
const datetime = GLib.DateTime.new_now_local(); const datetime = GLib.DateTime.new_now_local();
const datestr = datetime.format('%0X'); const datestr = datetime.format('%H-%M-%S');
const datestrEscaped = datestr.replace(/\//g, ':');
filename += datestrEscaped; filename += datestr;
break; break;
} }