Daniele Bartolini 10 лет назад
Родитель
Сommit
dc376fd5b5
2 измененных файлов с 25 добавлено и 23 удалено
  1. 7 0
      src/resource/bundle_compiler.cpp
  2. 18 23
      src/resource/bundle_compiler.h

+ 7 - 0
src/resource/bundle_compiler.cpp

@@ -132,6 +132,7 @@ bool BundleCompiler::compile_all(const char* platform)
 		if (_files[i].ends_with(".sh")
 			|| _files[i].ends_with(".sc")
 			|| _files[i].ends_with(".tmp")
+			|| _files[i].ends_with(".temp")
 			|| _files[i].ends_with(".wav")
 			|| _files[i].ends_with(".ogg")
 			|| _files[i].ends_with(".png")
@@ -139,6 +140,8 @@ bool BundleCompiler::compile_all(const char* platform)
 			|| _files[i].ends_with(".dds")
 			|| _files[i].ends_with(".ktx")
 			|| _files[i].ends_with(".pvr")
+			|| _files[i].ends_with(".swp") // VIM swap file.
+			|| _files[i].ends_with("~")
 			|| _files[i].starts_with(".")
 			)
 		continue;
@@ -146,6 +149,10 @@ bool BundleCompiler::compile_all(const char* platform)
 		const char* filename = _files[i].c_str();
 		const char* type = path::extension(filename);
 
+		// Ignore files without extension
+		if (type == NULL)
+			continue;
+
 		char name[256];
 		const u32 size = u32(type - filename - 1);
 		strncpy(name, filename, size);

+ 18 - 23
src/resource/bundle_compiler.h

@@ -13,31 +13,8 @@ namespace crown
 {
 class BundleCompiler
 {
-public:
-
-	BundleCompiler(const char* source_dir, const char* bundle_dir);
-
-	bool compile(const char* type, const char* name, const char* platform);
-
-	/// Compiles all the resources found in @a source_dir and puts them in @a bundle_dir.
-	/// Returns true on success, false otherwise.
-	bool compile_all(const char* platform);
-
-	/// Scans the source directory for resources.
-	void scan_source_dir(const char* path);
-
-private:
-
 	typedef void (*CompileFunction)(const char* path, CompileOptions& opts);
 
-	void register_resource_compiler(StringId64 type, u32 version, CompileFunction compiler);
-	void compile(StringId64 type, const char* path, CompileOptions& opts);
-
-	// Returns the version of the compiler for @a type.
-	u32 version(StringId64 type);
-
-private:
-
 	DiskFilesystem _source_fs;
 	DiskFilesystem _bundle_fs;
 
@@ -49,6 +26,24 @@ private:
 
 	SortMap<StringId64, ResourceTypeData> _compilers;
 	Vector<DynamicString> _files;
+
+	void register_resource_compiler(StringId64 type, u32 version, CompileFunction compiler);
+	void compile(StringId64 type, const char* path, CompileOptions& opts);
+	// Returns the version of the compiler for @a type.
+	u32 version(StringId64 type);
+
+public:
+
+	BundleCompiler(const char* source_dir, const char* bundle_dir);
+
+	bool compile(const char* type, const char* name, const char* platform);
+
+	/// Compiles all the resources found in @a source_dir and puts them in @a bundle_dir.
+	/// Returns true on success, false otherwise.
+	bool compile_all(const char* platform);
+
+	/// Scans the source directory for resources.
+	void scan_source_dir(const char* path);
 };
 
 namespace bundle_compiler