Blender Git Commit Log

Git Commits -> Revision 6de85a0

Revision 6de85a0 by Julian Eisel (master)
December 11, 2020, 15:20 (GMT)
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

Commit Details:

Full Hash: 6de85a0cc08da26f63ae0512f19fa5360556c2bd
Parent Commit: c8a3d1a
Lines Changed: +201, -0

10 Modified Paths:

/intern/ghost/GHOST_ISystemPaths.h (+6, -0) (Diff)
/intern/ghost/GHOST_Path-api.h (+6, -0) (Diff)
/intern/ghost/GHOST_Types.h (+10, -0) (Diff)
/intern/ghost/intern/GHOST_Path-api.cpp (+6, -0) (Diff)
/intern/ghost/intern/GHOST_SystemPathsCocoa.h (+6, -0) (Diff)
/intern/ghost/intern/GHOST_SystemPathsCocoa.mm (+52, -0) (Diff)
/intern/ghost/intern/GHOST_SystemPathsUnix.cpp (+58, -0) (Diff)
/intern/ghost/intern/GHOST_SystemPathsUnix.h (+6, -0) (Diff)
/intern/ghost/intern/GHOST_SystemPathsWin32.cpp (+45, -0) (Diff)
/intern/ghost/intern/GHOST_SystemPathsWin32.h (+6, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021