'Continue' most recent savegame

Hello there,

We are trying to code a ‘Continue’ button in our Main Menu that would load the most recently created savegame, but is not always working (sometimes it does, sometimes not). Do you guys have any advice on how to proceed with this? Here’s our code so far:

DirectoryInfo dirInfo = new DirectoryInfo(PlatformPath.GetPersistentPath());//Savegames data
		if (dirInfo.Exists) {
			FileInfo[] filesInfo = dirInfo.GetFiles ("SaveSlot*.sav");
			if (filesInfo.Length == 0) {
				DeactiveContinue ();
			} else {
				int selIndex = 0;
				filesInfo[selIndex].Refresh();
				for (int i = 0; i < filesInfo.Length; ++i) {
					filesInfo*.Refresh ();*

_ if (filesInfo .CreationTime > filesInfo [selIndex].CreationTime)_
* selIndex = i;*
* }*

* continueFileName_ = filesInfo [selIndex].Name;*

* }*
* } else {*
* DeactiveContinue ();*
* }*
Maybe the CreationTime property is not the most appropriate way to check this, but we are not sure.
Thanks in advance

You may be running into something called Tunnelling. From this StackOverflow answer:

I believe you are encountering a phenomenon in Windows known as filesystem tunneling. This is a feature of NT based systems wherein a new file with the same name as a recently deleted file in the same directory will inherit the creation time of the old file.

It looks like you can deal with this by explicitly setting the create time when you create the file:

You could use SetFileTime to update
the create time as soon as you create
the file.