summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/boot.php b/boot.php
index 5cfca7a..c7eb425 100644
--- a/boot.php
+++ b/boot.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__ . '/vendor/autoload.php';
+require_once __DIR__.'/vendor/autoload.php';
use GameBoy\Canvas\TerminalCanvas;
use GameBoy\Core;
@@ -15,7 +15,12 @@ if (count($argv) < 2) {
throw new RuntimeException('You need to pass the ROM file name (Ex: drmario.rom)');
}
-$rom = file_get_contents('roms/' . $argv[1]);
+$filename = 'roms/'.$argv[1];
+if (!file_exists($filename)) {
+ throw new RuntimeException(sprintf('"%s" does not exist', $filename));
+}
+
+$rom = file_get_contents($filename);
$canvas = new TerminalCanvas();
$core = new Core($rom, $canvas);