1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Fix --generate-mono-glue bug when directory doesn't exist

DirAccess::get_full_path(path) only works if the path exists. Implement our own abspath function.
This commit is contained in:
Ignacio Etcheverry
2019-07-08 15:16:35 +02:00
parent 2c83255013
commit 5ed3d34cd9
4 changed files with 132 additions and 65 deletions

View File

@@ -31,24 +31,32 @@
#ifndef PATH_UTILS_H
#define PATH_UTILS_H
#include "core/string_builder.h"
#include "core/ustring.h"
_FORCE_INLINE_ String path_join(const String &e1, const String &e2) {
return e1.plus_file(e2);
}
namespace path {
_FORCE_INLINE_ String path_join(const String &e1, const String &e2, const String &e3) {
return e1.plus_file(e2).plus_file(e3);
}
String join(const String &p_a, const String &p_b);
String join(const String &p_a, const String &p_b, const String &p_c);
String join(const String &p_a, const String &p_b, const String &p_c, const String &p_d);
_FORCE_INLINE_ String path_join(const String &e1, const String &e2, const String &e3, const String &e4) {
return e1.plus_file(e2).plus_file(e3).plus_file(e4);
}
String find_executable(const String &p_name);
String path_which(const String &p_name);
/// Returns a normalized absolute path to the current working directory
String cwd();
void fix_path(const String &p_path, String &r_out);
/**
* Obtains a normalized absolute path to p_path. Symbolic links are
* not resolved. The path p_path might not exist in the file system.
*/
String abspath(const String &p_path);
bool rel_path_to_abs(const String &p_existing_path, String &r_abs_path);
/**
* Obtains a normalized path to p_path with symbolic links resolved.
* The resulting path might be either a relative or an absolute path.
*/
String realpath(const String &p_path);
} // namespace path
#endif // PATH_UTILS_H