I have now uploaded a version that prints the raw error number together with the message (same link). I could not test it because I could not think of an easy way togenerate errors. Could you try that for me? It should still give the same problem, but I would want to know what exactly that problem is.
The solution I am thinking of now is something like you propsed, except in a loop, so that it tries as often as needed. I don't want it to miss saving a file ever. But I don'twant it to get stuck in an infinite loop either when there is a genuine reason why the save does not work (like an invalid path name). So I want to loop back only when the error number for the failure that is given is equal to this mysterious case.
Testing shows two errors:I uploaded a version now that does upto 2 retries on a fail with errno == 13. This should alleviate the problem, although there is no guarantee it will always work. I guess it would be better to "stat" the file or diretory, to check what the permissions are, and if they are such that the operation inprinciple should suceed, keep trying as long as needed.
---------------------------------
Can't open "C:\chess.pgn":
The data is invalid.
[13]
---------------------------------
The other is not a pop_up, but rather a fail-soft exit, and it's just like it exits the /mg loop and closes the GUI as if it were done. I cannot tell if it saves the game before these exits occur or pop_ups happen currently.
Does the GUI exit after 2 failed attempts? Does the attempt counter reset after each game played or each game successfully saved?
---------------------------------
What about dumping the pgn to an errno.pgn file so the game isn't lost?
What about storing all the games in memory, and then dumping them all when /mg is done to a file rather individually?