[blam] ItemStore: Fail gracefully if the DB file isn't found



commit 0947e274614258ed0a666bece046abaafd8d4c02
Author: Carlos Martín Nieto <carlos cmartin tk>
Date:   Sat Mar 26 12:26:01 2011 +0100

    ItemStore: Fail gracefully if the DB file isn't found
    
    Return immediately if the backing file isn't found instead of creating
    and empty one and have the parser throw an exception which causes
    higher levels to use the default channels.
    
    Signed-off-by: Carlos Martín Nieto <carlos cmartin tk>

 src/ItemStore.cs |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/src/ItemStore.cs b/src/ItemStore.cs
index 2b4060a..625d405 100644
--- a/src/ItemStore.cs
+++ b/src/ItemStore.cs
@@ -67,13 +67,8 @@ namespace Imendio.Blam
             XmlReader reader;
             try{
                 reader = new XmlTextReader(itemfile);
-            } catch(FileNotFoundException e){
-                File.Create(itemfile);
-                reader = new XmlTextReader(itemfile);
-            }
-            catch(Exception e){
-                Console.WriteLine(e.Message);
-                Console.WriteLine("item file not found");
+            } catch(Exception e){
+                Console.WriteLine("Can't open item db: {0}", e.Message);
                 return;
             }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]