Răsfoiți Sursa

Check whether source file exists

Daniele Bartolini 9 ani în urmă
părinte
comite
3ec5e08203
2 a modificat fișierele cu 4 adăugiri și 0 ștergeri
  1. 3 0
      src/resource/compile_options.h
  2. 1 0
      src/resource/texture_resource.cpp

+ 3 - 0
src/resource/compile_options.h

@@ -21,6 +21,9 @@
 #define RESOURCE_COMPILER_ASSERT_RESOURCE_EXISTS(type, name, opts)\
 #define RESOURCE_COMPILER_ASSERT_RESOURCE_EXISTS(type, name, opts)\
 	RESOURCE_COMPILER_ASSERT(opts.resource_exists(type, name), opts, "Resource does not exist: '%s.%s'", name, type)
 	RESOURCE_COMPILER_ASSERT(opts.resource_exists(type, name), opts, "Resource does not exist: '%s.%s'", name, type)
 
 
+#define RESOURCE_COMPILER_ASSERT_FILE_EXISTS(name, opts)\
+	RESOURCE_COMPILER_ASSERT(opts.file_exists(name), opts, "File does not exist: '%s'", name)
+
 namespace crown
 namespace crown
 {
 {
 class CompileOptions
 class CompileOptions

+ 1 - 0
src/resource/texture_resource.cpp

@@ -46,6 +46,7 @@ namespace texture_resource
 
 
 		DynamicString name(ta);
 		DynamicString name(ta);
 		sjson::parse_string(object["source"], name);
 		sjson::parse_string(object["source"], name);
+		RESOURCE_COMPILER_ASSERT_FILE_EXISTS(name.c_str(), opts);
 
 
 		const bool generate_mips = sjson::parse_bool(object["generate_mips"]);
 		const bool generate_mips = sjson::parse_bool(object["generate_mips"]);
 		const bool is_normalmap  = sjson::parse_bool(object["is_normalmap"]);
 		const bool is_normalmap  = sjson::parse_bool(object["is_normalmap"]);