diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2021-12-11 19:59:53 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2021-12-11 19:59:53 +0300 |
commit | 9df13fba69c3b0e0e013db198515e6e1a7238f6a (patch) | |
tree | bd885ea12f406316ab38e42465cc864328c45bd2 /source/blender/blenlib/BLI_fileops.h | |
parent | 23be5fd4499ad92c049f140564df3e32cfe9cea3 (diff) |
macOS: add tilde-based path expander
Replaces `HOME` environment variable usage for user
directories like in D12802.
Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13212
Diffstat (limited to 'source/blender/blenlib/BLI_fileops.h')
-rw-r--r-- | source/blender/blenlib/BLI_fileops.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 932b67866ea..2ef9b8f6c36 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -322,6 +322,14 @@ void *BLI_file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t */ void BLI_file_free_lines(struct LinkNode *lines); +#ifdef __APPLE__ +/** + * Expand the leading `~` in the given path to `/Users/$USER`. + * This doesn't preserve the trailing path separator. + * Giving a path without leading `~` is not an error. + */ +const char *BLI_expand_tilde(const char *path_with_tilde); +#endif /* This weirdo pops up in two places. */ #if !defined(WIN32) # ifndef O_BINARY |