فهرست منبع

core: get_absolute_path() -> absolute_path()

Daniele Bartolini 6 سال پیش
والد
کامیت
910ace0fa2

+ 8 - 1
src/core/filesystem/filesystem.h

@@ -18,9 +18,16 @@ namespace crown
 /// @ingroup Filesystem
 struct Filesystem
 {
+	///
 	Filesystem() {};
+
+	///
 	virtual ~Filesystem() {};
+
+	///
 	Filesystem(const Filesystem&) = delete;
+
+	///
 	Filesystem& operator=(const Filesystem&) = delete;
 
 	/// Opens the file at the given @a path with the given @a mode.
@@ -59,7 +66,7 @@ struct Filesystem
 	/// Returns the absolute path of the given @a path based on
 	/// the root path of the file source. If @a path is absolute,
 	/// the given path is returned.
-	virtual void get_absolute_path(const char* path, DynamicString& os_path) = 0;
+	virtual void absolute_path(DynamicString& os_path, const char* path) = 0;
 };
 
 } // namespace crown

+ 1 - 1
src/core/filesystem/filesystem_apk.cpp

@@ -205,7 +205,7 @@ void FilesystemApk::list_files(const char* path, Vector<DynamicString>& files)
 	AAssetDir_close(root_dir);
 }
 
-void FilesystemApk::get_absolute_path(const char* path, DynamicString& os_path)
+void FilesystemApk::absolute_path(DynamicString& os_path, const char* path)
 {
 	os_path = path;
 }

+ 2 - 2
src/core/filesystem/filesystem_apk.h

@@ -59,8 +59,8 @@ struct FilesystemApk : public Filesystem
 	/// @copydoc Filesystem::list_files()
 	void list_files(const char* path, Vector<DynamicString>& files);
 
-	/// @copydoc Filesystem::get_absolute_path()
-	void get_absolute_path(const char* path, DynamicString& os_path);
+	/// @copydoc Filesystem::absolute_path()
+	void absolute_path(DynamicString& os_path, const char* path);
 };
 
 } // namespace crown

+ 7 - 7
src/core/filesystem/filesystem_disk.cpp

@@ -242,7 +242,7 @@ File* FilesystemDisk::open(const char* path, FileOpenMode::Enum mode)
 
 	TempAllocator256 ta;
 	DynamicString abs_path(ta);
-	get_absolute_path(path, abs_path);
+	absolute_path(abs_path, path);
 
 	FileDisk* file = CE_NEW(*_allocator, FileDisk)();
 	file->open(abs_path.c_str(), mode);
@@ -260,7 +260,7 @@ Stat FilesystemDisk::stat(const char* path)
 
 	TempAllocator256 ta;
 	DynamicString abs_path(ta);
-	get_absolute_path(path, abs_path);
+	absolute_path(abs_path, path);
 
 	Stat info;
 	os::stat(info, abs_path.c_str());
@@ -293,7 +293,7 @@ CreateResult FilesystemDisk::create_directory(const char* path)
 
 	TempAllocator256 ta;
 	DynamicString abs_path(ta);
-	get_absolute_path(path, abs_path);
+	absolute_path(abs_path, path);
 
 	return os::create_directory(abs_path.c_str());
 }
@@ -304,7 +304,7 @@ DeleteResult FilesystemDisk::delete_directory(const char* path)
 
 	TempAllocator256 ta;
 	DynamicString abs_path(ta);
-	get_absolute_path(path, abs_path);
+	absolute_path(abs_path, path);
 
 	return os::delete_directory(abs_path.c_str());
 }
@@ -315,7 +315,7 @@ DeleteResult FilesystemDisk::delete_file(const char* path)
 
 	TempAllocator256 ta;
 	DynamicString abs_path(ta);
-	get_absolute_path(path, abs_path);
+	absolute_path(abs_path, path);
 
 	return os::delete_file(abs_path.c_str());
 }
@@ -326,12 +326,12 @@ void FilesystemDisk::list_files(const char* path, Vector<DynamicString>& files)
 
 	TempAllocator256 ta;
 	DynamicString abs_path(ta);
-	get_absolute_path(path, abs_path);
+	absolute_path(abs_path, path);
 
 	os::list_files(abs_path.c_str(), files);
 }
 
-void FilesystemDisk::get_absolute_path(const char* path, DynamicString& os_path)
+void FilesystemDisk::absolute_path(DynamicString& os_path, const char* path)
 {
 	if (path::is_absolute(path))
 	{

+ 2 - 2
src/core/filesystem/filesystem_disk.h

@@ -63,8 +63,8 @@ struct FilesystemDisk : public Filesystem
 	/// @copydoc Filesystem::list_files()
 	void list_files(const char* path, Vector<DynamicString>& files);
 
-	/// @copydoc Filesystem::get_absolute_path()
-	void get_absolute_path(const char* path, DynamicString& os_path);
+	/// @copydoc Filesystem::absolute_path()
+	void absolute_path(DynamicString& os_path, const char* path);
 };
 
 } // namespace crown

+ 3 - 3
src/resource/compile_options.cpp

@@ -139,7 +139,7 @@ void CompileOptions::add_requirement(const char* type, const char* name)
 	_data_compiler.add_requirement(_resource_id, path.c_str());
 }
 
-void CompileOptions::get_absolute_path(const char* path, DynamicString& abs)
+void CompileOptions::absolute_path(const char* path, DynamicString& abs)
 {
 	TempAllocator256 ta;
 	DynamicString source_dir(ta);
@@ -147,7 +147,7 @@ void CompileOptions::get_absolute_path(const char* path, DynamicString& abs)
 
 	FilesystemDisk source_filesystem(ta);
 	source_filesystem.set_prefix(source_dir.c_str());
-	source_filesystem.get_absolute_path(path, abs);
+	source_filesystem.absolute_path(abs, path);
 }
 
 void CompileOptions::get_temporary_path(const char* suffix, DynamicString& abs)
@@ -157,7 +157,7 @@ void CompileOptions::get_temporary_path(const char* suffix, DynamicString& abs)
 	DynamicString prefix(ta);
 	prefix.from_guid(guid::new_guid());
 
-	_data_filesystem.get_absolute_path(CROWN_TEMP_DIRECTORY, str);
+	_data_filesystem.absolute_path(str, CROWN_TEMP_DIRECTORY);
 
 	path::join(abs, str.c_str(), prefix.c_str());
 	abs += '.';

+ 1 - 1
src/resource/compile_options.h

@@ -111,7 +111,7 @@ struct CompileOptions
 	void add_requirement(const char* type, const char* name);
 
 	///
-	void get_absolute_path(const char* path, DynamicString& abs);
+	void absolute_path(const char* path, DynamicString& abs);
 
 	///
 	void get_temporary_path(const char* suffix, DynamicString& abs);

+ 1 - 1
src/resource/lua_resource.cpp

@@ -38,7 +38,7 @@ namespace lua_resource_internal
 		TempAllocator1024 ta;
 		DynamicString luasrc(ta);
 		DynamicString luabin(ta);
-		opts.get_absolute_path(opts.source_path(), luasrc);
+		opts.absolute_path(opts.source_path(), luasrc);
 		opts.get_temporary_path("lua", luabin);
 
 		const char* argv[] =

+ 1 - 1
src/resource/texture_resource.cpp

@@ -93,7 +93,7 @@ namespace texture_resource_internal
 
 		DynamicString texsrc(ta);
 		DynamicString texout(ta);
-		opts.get_absolute_path(name.c_str(), texsrc);
+		opts.absolute_path(name.c_str(), texsrc);
 		opts.get_temporary_path("ktx", texout);
 
 		const char* texturec = opts.exe_path(texturec_paths, countof(texturec_paths));