MeshLib Documentation
Loading...
Searching...
No Matches
MRSystemPath.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRExpected.h"
5
6#include <filesystem>
7
8namespace MR
9{
10
13{
14public:
15#ifndef MR_PARSING_FOR_PB11_BINDINGS
18
21
24
27#endif
28
30 enum class Directory
31 {
35 Fonts,
37 Plugins,
40 Count
41 };
42
43 // supported types of system fonts fonts
44 enum class SystemFontType
45 {
46 Regular,
47 Bold,
48 Italic,
50 Count
51 };
52
53 using SystemFontPaths = std::array<std::filesystem::path, size_t( SystemFontType::Count )>;
54
56 MRMESH_API static std::filesystem::path getDirectory( Directory dir );
58 MRMESH_API static void overrideDirectory( Directory dir, const std::filesystem::path& path );
59
61 static std::filesystem::path getResourcesDirectory() { return getDirectory( Directory::Resources ); }
63 static std::filesystem::path getFontsDirectory() { return getDirectory( Directory::Fonts ); }
65 static std::filesystem::path getPluginsDirectory() { return getDirectory( Directory::Plugins ); }
67 static std::filesystem::path getPythonModulesDirectory() { return getDirectory( Directory::PythonModules ); }
69 MRMESH_API static const std::vector<SystemFontPaths>& getSystemFonts();
70
71private:
72 static SystemPath& instance_();
73
74 std::array<std::filesystem::path, (size_t)Directory::Count> directories_;
75};
76
77} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
system directory path manager
Definition MRSystemPath.h:13
static std::filesystem::path getPythonModulesDirectory()
get the Python modules' binaries' directory path
Definition MRSystemPath.h:67
SystemFontType
Definition MRSystemPath.h:45
static std::filesystem::path getPluginsDirectory()
get the plugin binaries' directory path
Definition MRSystemPath.h:65
static MRMESH_API const std::vector< SystemFontPaths > & getSystemFonts()
get name all system fonts that have italics, bold, bold italics
static MRMESH_API Expected< std::filesystem::path > getLibraryDirectory()
get the MRMesh binary's directory path
static std::filesystem::path getFontsDirectory()
get the font files' directory path
Definition MRSystemPath.h:63
static MRMESH_API Expected< std::filesystem::path > getLibraryPath()
get the MRMesh binary's file path
static MRMESH_API Expected< std::filesystem::path > getExecutableDirectory()
get the current executable's directory path
static std::filesystem::path getResourcesDirectory()
get the resource files' directory path
Definition MRSystemPath.h:61
static MRMESH_API void overrideDirectory(Directory dir, const std::filesystem::path &path)
override the directory path for specified category, useful for custom configurations
static MRMESH_API Expected< std::filesystem::path > getExecutablePath()
get the current executable's file path
std::array< std::filesystem::path, size_t(SystemFontType::Count)> SystemFontPaths
Definition MRSystemPath.h:53
static MRMESH_API std::filesystem::path getDirectory(Directory dir)
get the directory path for specified category
Directory
directory category
Definition MRSystemPath.h:31
@ Fonts
fonts (.ttf, .otf)
@ PythonModules
Python modules (.pyd, .so, .dylib, .pyi)
@ Plugins
plugins (.dll, .so, .dylib)
@ Resources
resources (.json, .png)
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58