added _noerror version of functions
authorMatthias Kramm <kramm@quiss.org>
Sat, 14 Mar 2009 20:00:59 +0000 (21:00 +0100)
committerMatthias Kramm <kramm@quiss.org>
Sat, 14 Mar 2009 20:00:59 +0000 (21:00 +0100)
lib/as3/files.c
lib/as3/files.h

index 5cd1e2e..6e75fd7 100644 (file)
@@ -201,7 +201,7 @@ char is_absolute(const char*filename)
     return 0;
 }
 
-char*find_file(const char*filename)
+char*find_file(const char*filename, char error)
 {
     include_dir_t*i = current_include_dirs;
     FILE*fi = 0;
@@ -212,7 +212,7 @@ char*find_file(const char*filename)
             return strdup(filename);
         }
     } else {
-        if(!i) {
+        if(!i && error) {
             as3_warning("Include directory stack is empty, while looking for file %s", filename);
         }
         while(i) {
@@ -227,6 +227,9 @@ char*find_file(const char*filename)
             i = i->next;
         }
     }
+    if(!error) {
+        return 0;
+    }
 
     as3_error("Couldn't find file %s", filename);
     i = current_include_dirs;
index ae31212..8af24b7 100644 (file)
@@ -35,7 +35,7 @@ extern include_dir_t* current_include_dirs;
 
 void add_include_dir(char*dir);
 
-char*find_file(const char*filename);
+char*find_file(const char*filename, char report_errors);
 void enter_file(const char*name, const char*filename, void*state);
 FILE* enter_file2(const char*name, const char*filename, void*state);
 void* leave_file();