diff options
author | Julian Eisel <julian@blender.org> | 2020-12-11 17:36:29 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-11 18:20:53 +0300 |
commit | 6de85a0cc08da26f63ae0512f19fa5360556c2bd (patch) | |
tree | f3ffea47f230064a6ca36cbeaa145c5e7ee43c6c /intern/ghost/GHOST_Types.h | |
parent | c8a3d1a1fa65f2ff21202d79c5f027119203319f (diff) |
Ghost: Support queries for special user directories (desktop, documents, etc.)
When we had to get special user directories, we'd usually do it in varying,
rather ad-hoc ways. It would be done with a bunch of `#ifdef`s for the
different operating systems. Also, some of the used Win32 functions were legacy
ones and the API docs recommend using newer ones.
Further, seems `BKE_appdir_folder_default()` used `XDG_DOCUMENTS_DIR` wrong.
It's not supposed to be an environment variable but a value inside a config
file.
This adds the platform dependent logic to Ghost, so we can abstract it away
nicely using the `GHOST_ISystemPaths` interface. Getting the desktop directory
for example can now easily be done with:
`GHOST_getUserSpecialDir(GHOST_kUserSpecialDirDesktop).`
For now I added the logic for desktop, documents, downloads, videos, images and
music directories, even though we only use the Documents one. We can extend/
change this as needed, it's easy to do now.
On Windows and macOS, it uses pretty much the same way to access the
directories as elsewhere already. On Linux, it uses the `xdg-user-dir` command
that seems to be available by default on most Linux systems.
No functional changes. The new queries are not actually used yet.
Differential Revision: https://developer.blender.org/D9800
Reviewed by: Brecht Van Lommel
Diffstat (limited to 'intern/ghost/GHOST_Types.h')
-rw-r--r-- | intern/ghost/GHOST_Types.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index a03b59d14b0..8bce064ce63 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -565,6 +565,16 @@ typedef struct { char is_repeat; } GHOST_TEventKeyData; +typedef enum { + GHOST_kUserSpecialDirDesktop, + GHOST_kUserSpecialDirDocuments, + GHOST_kUserSpecialDirDownloads, + GHOST_kUserSpecialDirMusic, + GHOST_kUserSpecialDirPictures, + GHOST_kUserSpecialDirVideos, + /* Can be extended as needed. */ +} GHOST_TUserSpecialDirTypes; + typedef struct { /** Number of pixels on a line. */ GHOST_TUns32 xPixels; |