Fix upload dialog re-trigger + add game size to detail page
Build & Deploy / build-and-deploy (push) Failing after 34s
Build & Deploy / build-and-deploy (push) Failing after 34s
- Fixed: navigating back to library no longer re-opens file dialog (prev-value guard in uploadTriggered effect) - Added bundleSize field to Game, populated at load time from .jsdos file - Game detail page shows file size next to DOS badge (e.g. 'DOS · 127 MB')
This commit is contained in:
@@ -23,6 +23,9 @@ public class Game {
|
||||
|
||||
private String setupExe; // relative path to SETUP.EXE (null if none)
|
||||
|
||||
/** Game bundle file size in bytes. Populated dynamically at load time (not persisted). */
|
||||
private Long bundleSize;
|
||||
|
||||
/** Currently selected main executable (relative path inside the bundle, e.g. "FALLOUT.EXE" or "FALLOUT/FALLOUT.EXE"). */
|
||||
private String executable;
|
||||
|
||||
@@ -91,6 +94,9 @@ public class Game {
|
||||
public String getSetupExe() { return setupExe; }
|
||||
public void setSetupExe(String setupExe) { this.setupExe = setupExe; }
|
||||
|
||||
public Long getBundleSize() { return bundleSize; }
|
||||
public void setBundleSize(Long bundleSize) { this.bundleSize = bundleSize; }
|
||||
|
||||
public String getExecutable() { return executable; }
|
||||
public void setExecutable(String executable) { this.executable = executable; }
|
||||
|
||||
|
||||
@@ -67,8 +67,14 @@ public class GameService {
|
||||
Files.exists(gameDir(id).resolve("cover.png")) ||
|
||||
Files.exists(gameDir(id).resolve("cover.webp"))
|
||||
);
|
||||
// Detect bundle size
|
||||
try {
|
||||
Path bundlePath = gamesDir.resolve(game.getBundleFile());
|
||||
if (bundlePath != null && Files.exists(bundlePath)) {
|
||||
game.setBundleSize(Files.size(bundlePath));
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
return game;
|
||||
}
|
||||
|
||||
/** Save game metadata to disk. */
|
||||
public void save(Game game) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user