The file file.c has a function GetFilename which includes the line

        if (mi.nYear)
            sz = g_strdup_printf("%s-%s_%dp_%04u-%02u-%02u.sgf", ap[0].szName, 
ap[1].szName, ms. nMatchTo, mi.nYear, mi.nMonth, mi.nDay);


I couldn’t find where mi is set, but  if it includes the parameters nHour and 
nMinute it would be easy to add these to the name.

The else condition of (mi.nYear) contains code that does appear to use the hour 
and minute, so it looks like there might be some inconsistency:


            if (strftime(tstr, 14, "%Y-%m-%d-%H%M", localtime(&t)) == 0)

                *tstr = '\0';



            sz = g_strdup_printf("%s-%s_%dp_%s.sgf", ap[0].szName, 
ap[1].szName, ms.nMatchTo, tstr);



From: bug-gnubg-bounces+ian.shaw=riverauto.co...@gnu.org 
<bug-gnubg-bounces+ian.shaw=riverauto.co...@gnu.org> On Behalf Of Wayne Joseph
Sent: Thursday, January 18, 2024 11:33 AM
To: bug-gnubg@gnu.org
Subject: Improved gnubg filenaming convention - suggestion


Is the way gnubg names files something that just I find sub-optimal, or is it 
fine for everybody else?

I imagine like many of us, some days, I will play multiple matches (5-10) 
against gnubg backgammon. I like to analyse and save each of them afterwards

When I click save, by default, it auto names the file with the following 
convention:

gnubg–profilename_matchlength_yyyy-mm-dd

like.. gnubg–skope_5p_2024-01-18.sgf

I then click Save.

I might then play another match, analyse it and then try and save it

Unfortunately, it then tries to save with exactly the same naming convention

gnubg–profilename_matchlength_yyyy-mm-dd

gnubg–skope_5p_2024-01-18.sgf

Of course, this leads to a file name clash and an error message is presented 
each and every time:

File "\gnubg–profilename_matchlength_yyyy-mm-dd.sgf" exists. Overwrite?

----------

To propose a relatively 'easy' solution to this, I think it would make better 
sense to add an hour-minute timestamp to the existing file name convention?

i.e.

"\gnubg–profilename_matchlength_yyyy-mm-dd_hh-mm.sgf

That way one could save multiple matches played the same day without repeatedly 
encountering the error message and the need to manually rename each saved match 
file to something unique.

In addition, for a cherry on top, it would be even better if the error rate for 
each analysed match was also appended to the file name i.e. -4.3 or -8.5 or 
whatever. This could allow for even easier searching and filtering/foldering of 
match files with blunders for retrospective study on each user's PC

---------

To make it clearer -

Old style filename:

gnubg–skope_5p_2024-01-18.sgf

vs

New style auto-unique filename:

gnubg–skope_5p_2024-01-18_17-05_4.3.sgf

---------

I'll admit, the proposed file name convention is longer and perhaps less 
'readable' but the benefit is it contains more valuable information, adds 
utility and is unique.



Who is the best person in the bg community to speak to in order to give this 
feature request the best chance of being implemented please?

Reply via email to