Ver Fonte

resource: skip checks which syscall would do (better) anyway

Daniele Bartolini há 6 anos atrás
pai
commit
49cde12bd1

+ 2 - 3
src/resource/compile_options.cpp

@@ -150,10 +150,9 @@ void CompileOptions::get_temporary_path(const char* suffix, DynamicString& abs)
 	abs += suffix;
 }
 
-void CompileOptions::delete_file(const char* path)
+DeleteResult CompileOptions::delete_file(const char* path)
 {
-	if (_data_filesystem.exists(path))
-		_data_filesystem.delete_file(path);
+	return _data_filesystem.delete_file(path);
 }
 
 void CompileOptions::write(const void* data, u32 size)

+ 2 - 1
src/resource/compile_options.h

@@ -7,6 +7,7 @@
 
 #include "core/containers/types.h"
 #include "core/filesystem/types.h"
+#include "core/os.h"
 #include "core/strings/dynamic_string.h"
 #include "core/strings/types.h"
 #include "resource/types.h"
@@ -109,7 +110,7 @@ struct CompileOptions
 	void get_temporary_path(const char* suffix, DynamicString& abs);
 
 	///
-	void delete_file(const char* path);
+	DeleteResult delete_file(const char* path);
 
 	///
 	void write(const void* data, u32 size);

+ 2 - 6
src/resource/data_compiler.cpp

@@ -755,12 +755,8 @@ bool DataCompiler::compile(const char* data_dir, const char* platform)
 	FilesystemDisk data_fs(default_allocator());
 	data_fs.set_prefix(data_dir);
 	data_fs.create_directory("");
-
-	if (!data_fs.exists(CROWN_DATA_DIRECTORY))
-		data_fs.create_directory(CROWN_DATA_DIRECTORY);
-
-	if (!data_fs.exists(CROWN_TEMP_DIRECTORY))
-		data_fs.create_directory(CROWN_TEMP_DIRECTORY);
+	data_fs.create_directory(CROWN_DATA_DIRECTORY);
+	data_fs.create_directory(CROWN_TEMP_DIRECTORY);
 
 	// Find the set of resources to be compiled
 	Vector<DynamicString> to_compile(default_allocator());