diff --git a/game-app/game-core/src/main/java/games/strategy/engine/framework/AutoSaveFileUtils.java b/game-app/game-core/src/main/java/games/strategy/engine/framework/AutoSaveFileUtils.java index 499a035281..7a3145e3ad 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/framework/AutoSaveFileUtils.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/framework/AutoSaveFileUtils.java @@ -26,6 +26,18 @@ public class AutoSaveFileUtils { /** Returns a list path objects representing each auto save file. */ public static List getAutoSavePaths() { var autoSaveFolder = ClientSetting.saveGamesFolderPath.getValueOrThrow().resolve("autoSave"); + + if (!Files.exists(autoSaveFolder)) { + try { + Files.createDirectories(autoSaveFolder); + } catch (IOException e) { + throw new RuntimeException( + "Autosave folder did not exist, was not able to create it. Required folder: " + + autoSaveFolder.toAbsolutePath(), + e); + } + } + try (Stream paths = Files.list(autoSaveFolder)) { return paths.filter(f -> !Files.isDirectory(f)).collect(Collectors.toList()); } catch (IOException e) {