changeset 338:65453340ae95

Print an error when all the needed files aren’t present.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 04 Jul 2012 18:08:57 +0200
parents bc162f60f0a0
children 7a05edbab88a
files eosd pytouhou/resource/loader.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/eosd
+++ b/eosd
@@ -15,6 +15,7 @@
 
 import argparse
 import os
+import sys
 
 import pyximport
 pyximport.install()
@@ -51,7 +52,12 @@ class EoSDGameBossRush(EoSDGame):
 
 def main(path, data, stage_num, rank, character, replay, boss_rush, fps_limit, single_buffer):
     resource_loader = Loader(path)
-    resource_loader.scan_archives(data)
+
+    try:
+        resource_loader.scan_archives(data)
+    except IOError:
+        sys.stderr.write('Some data files were not found, did you forget the -p option?\n')
+        exit(1)
 
     if stage_num is None:
         story = True
--- a/pytouhou/resource/loader.py
+++ b/pytouhou/resource/loader.py
@@ -120,6 +120,8 @@ class Loader(object):
                         path = os.path.join(self.game_dir, path)
                     yield glob(path)
             paths = list(chain(*_expand_paths()))
+            if not paths:
+                raise IOError
             path = paths[0]
             if os.path.splitext(path)[1] == '.exe':
                 self.exe_files.extend(paths)