diff options
| author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-07-08 15:16:35 +0200 |
|---|---|---|
| committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-07-08 18:07:15 +0200 |
| commit | 5ed3d34cd914ecd6930651769a423cad2999ca64 (patch) | |
| tree | 7f5f64af0c83b031c8d4484287e474eb4d6e33f0 /modules/mono/utils/path_utils.h | |
| parent | 2c83255013b45a558d967e190cf5ddfb03f09dd6 (diff) | |
| download | redot-engine-5ed3d34cd914ecd6930651769a423cad2999ca64.tar.gz | |
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.
Diffstat (limited to 'modules/mono/utils/path_utils.h')
| -rw-r--r-- | modules/mono/utils/path_utils.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h index 69edf4deb7..ca25bc09f7 100644 --- a/modules/mono/utils/path_utils.h +++ b/modules/mono/utils/path_utils.h @@ -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 |
