MeshLib C++ Docs
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
25
28
31#endif
32
34 enum class Directory
35 {
39 Fonts,
41 Plugins,
44 Count
45 };
46
47 // supported types of system fonts fonts
48 enum class SystemFontType
49 {
50 Regular,
51 Bold,
52 Italic,
54 Count
55 };
56
57 using SystemFontPaths = std::array<std::filesystem::path, size_t( SystemFontType::Count )>;
58
60 MRMESH_API static std::filesystem::path getDirectory( Directory dir );
62 MRMESH_API static void overrideDirectory( Directory dir, const std::filesystem::path& path );
63
65 static std::filesystem::path getResourcesDirectory() { return getDirectory( Directory::Resources ); }
67 static std::filesystem::path getFontsDirectory() { return getDirectory( Directory::Fonts ); }
69 static std::filesystem::path getPluginsDirectory() { return getDirectory( Directory::Plugins ); }
71 static std::filesystem::path getPythonModulesDirectory() { return getDirectory( Directory::PythonModules ); }
73 MRMESH_API static const std::vector<SystemFontPaths>& getSystemFonts();
74
75private:
76 static SystemPath& instance_();
77
78 std::array<std::filesystem::path, (size_t)Directory::Count> directories_;
79};
80
81} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
system directory path manager
Definition MRSystemPath.h:13
static std::filesystem::path getPythonModulesDirectory()
get the Python modules' binaries' directory path
Definition MRSystemPath.h:71
SystemFontType
Definition MRSystemPath.h:49
static std::filesystem::path getPluginsDirectory()
get the plugin binaries' directory path
Definition MRSystemPath.h:69
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 > getLibraryPathForSymbol(const void *symbol)
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:67
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:65
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:57
static MRMESH_API std::filesystem::path getDirectory(Directory dir)
get the directory path for specified category
Directory
directory category
Definition MRSystemPath.h:35
@ Fonts
fonts (.ttf, .otf)
@ PythonModules
Python modules (.pyd, .so, .dylib, .pyi)
@ Plugins
plugins (.dll, .so, .dylib)
@ Resources
resources (.json, .png)
tl::expected< T, E > Expected
Definition MRExpected.h:59