From: Matthias Kramm Date: Sat, 14 Mar 2009 20:00:59 +0000 (+0100) Subject: added _noerror version of functions X-Git-Tag: release-0-9-0~60 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=ac56d468c81e1ab25b32f5e1ddca6b867e386a93 added _noerror version of functions --- diff --git a/lib/as3/files.c b/lib/as3/files.c index 5cd1e2e..6e75fd7 100644 --- a/lib/as3/files.c +++ b/lib/as3/files.c @@ -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; diff --git a/lib/as3/files.h b/lib/as3/files.h index ae31212..8af24b7 100644 --- a/lib/as3/files.h +++ b/lib/as3/files.h @@ -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();