diff --git a/frontend/src/lib/api.js b/frontend/src/lib/api.js index 2cb803f..447b596 100644 --- a/frontend/src/lib/api.js +++ b/frontend/src/lib/api.js @@ -106,7 +106,9 @@ export function artworkUrl(path) { /** Get game bundle URL for normal play */ export function bundleUrl(game) { if (!game) return null; - return `/games/${game.id}.jsdos`; + // Use the bundle_file path from the backend (handles both old flat layout + // and new in-directory layout transparently) + return `/games/${game.bundle_file}`; } /** Get game bundle URL for setup mode (runs SETUP.EXE instead) */ diff --git a/src/main/java/com/dostalgia/GameService.java b/src/main/java/com/dostalgia/GameService.java index da78a70..5a31600 100644 --- a/src/main/java/com/dostalgia/GameService.java +++ b/src/main/java/com/dostalgia/GameService.java @@ -127,9 +127,8 @@ public class GameService { } }); } - // Remove flat .jsdos bundle + // Clean up old flat .jsdos locations (pre-game-dir layout — backward compat) Files.deleteIfExists(gamesDir.resolve(id + ".jsdos")); - // Remove flat setup .jsdos bundle (if any) Files.deleteIfExists(gamesDir.resolve(id + ".setup.jsdos")); return true; } diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index e498faf..6660f4c 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -95,9 +95,9 @@ public class UploadResource { Path gameDir = svc.gameDir(gameId); Files.createDirectories(gameDir); - // Create .jsdos bundle (ZIP with game files + .jsdos/ config) - String bundleFile = gameId + ".jsdos"; - Path bundlePath = svc.getGamesDir().resolve(bundleFile); + // Create .jsdos bundle inside the game directory + String bundleFile = gameId + "/" + gameId + ".jsdos"; + Path bundlePath = gameDir.resolve(gameId + ".jsdos"); createBundle(extractDir, mainExe, bundlePath); // Detect platform (DOS vs Windows) by reading the main EXE header