feat: store .jsdos bundle inside game directory instead of as flat file
Build & Deploy / build-and-deploy (push) Successful in 52s
Build & Deploy / build-and-deploy (push) Successful in 52s
Before: data/games/{id}.jsdos (flat, alongside the game dir)
After: data/games/{id}/{id}.jsdos (inside the game directory)
Benefits:
- Delete is atomic — removing the game dir removes everything
- Cleaner data directory structure
- No orphan .jsdos files on delete
Also updated frontend bundleUrl() to use game.bundle_file from
the backend, making it path-agnostic. Old flat layout is still
served via StaticResource for backward compat.
This commit is contained in:
@@ -106,7 +106,9 @@ export function artworkUrl(path) {
|
|||||||
/** Get game bundle URL for normal play */
|
/** Get game bundle URL for normal play */
|
||||||
export function bundleUrl(game) {
|
export function bundleUrl(game) {
|
||||||
if (!game) return null;
|
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) */
|
/** Get game bundle URL for setup mode (runs SETUP.EXE instead) */
|
||||||
|
|||||||
@@ -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"));
|
Files.deleteIfExists(gamesDir.resolve(id + ".jsdos"));
|
||||||
// Remove flat setup .jsdos bundle (if any)
|
|
||||||
Files.deleteIfExists(gamesDir.resolve(id + ".setup.jsdos"));
|
Files.deleteIfExists(gamesDir.resolve(id + ".setup.jsdos"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ public class UploadResource {
|
|||||||
Path gameDir = svc.gameDir(gameId);
|
Path gameDir = svc.gameDir(gameId);
|
||||||
Files.createDirectories(gameDir);
|
Files.createDirectories(gameDir);
|
||||||
|
|
||||||
// Create .jsdos bundle (ZIP with game files + .jsdos/ config)
|
// Create .jsdos bundle inside the game directory
|
||||||
String bundleFile = gameId + ".jsdos";
|
String bundleFile = gameId + "/" + gameId + ".jsdos";
|
||||||
Path bundlePath = svc.getGamesDir().resolve(bundleFile);
|
Path bundlePath = gameDir.resolve(gameId + ".jsdos");
|
||||||
createBundle(extractDir, mainExe, bundlePath);
|
createBundle(extractDir, mainExe, bundlePath);
|
||||||
|
|
||||||
// Detect platform (DOS vs Windows) by reading the main EXE header
|
// Detect platform (DOS vs Windows) by reading the main EXE header
|
||||||
|
|||||||
Reference in New Issue
Block a user