I recently built my own function to do this including sub folders but i was surprised there was no blueprint node to get a list of save slots, it seems to me like a list of saved games would be a fairly common thing to use.
I’ve included the code I used in case anyone wants to use it.
bool USaveSlotsList::GetFileList(TArray<FString>& Files, FString Path, FString Folder, FString Ext)
{
bool PathFound = true;
//get a new file manager
IFileManager& FileManager = IFileManager::Get();
//if path string doesnt exist or the directory doesnt exist
if (Path.Len() < 1 || !FileManager.DirectoryExists(Path.GetCharArray().GetData()))
{
//get the default user path
Path = FPaths::ConvertRelativePathToFull(FPaths::GameSavedDir());
Path = Path + "/SaveGames";
PathFound = false;
}
//if there is a folder
if (Folder.Len() > 0)
{
//check if the path ends with / or \
if (Path.EndsWith("/") || Path.EndsWith("\\"))
//if it does add the folder
Path = Path + Folder;
else
//if it doesnt add / and the folder
Path = Path + "/" + Folder;
}
//if there is no path (should never happen at this point) exit the function
if (Path.Len() < 1) return false;
FPaths::NormalizeDirectoryName(Path);
//find out what file extension we are looking for
if (Ext == "")
{
Ext = "*.*";
}
else
{
Ext = (Ext.Left(1) == ".") ? "*" + Ext : "*." + Ext;
}
FString FinalPath = Path + "/" + Ext;
//find all files in the folder with the desired file extension
FileManager.FindFiles(Files, *FinalPath, true, false);
//return true only if the path specified existed
return PathFound;
}