Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveAssetDir.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Matevz Tadel, 2026
3
4/*************************************************************************
5 * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_REveAssetDir
13#define ROOT7_REveAssetDir
14
15#include <string>
16#include <vector>
17
18namespace ROOT {
19namespace Experimental {
20namespace Internal {
21
22/// Directories of one kind of file the REve server serves under one http
23/// location prefix. Private to REve; see the class documentation in the .cxx.
25 std::string fPrefix; ///< http location prefix, such as "sdf-fonts/"
26 std::vector<std::string> fUserDirs; ///< set by the user, searched first, in order
27 std::vector<std::string> fFallbackDirs; ///< shipped with ROOT, read-only, searched after fUserDirs
28 std::string fWriteDir; ///< where new files are written; empty if none
29
30 static std::vector<REveAssetDir *> &Instances();
31
32public:
33 explicit REveAssetDir(const std::string &prefix);
35
36 REveAssetDir(const REveAssetDir &) = delete;
38
39 static std::string NormalizeDir(const std::string &dir);
40 static std::string GetUi5Dir();
41 static std::string GetAssetsDir();
42
43 /// @{ Accessors; the directories passed in are normalized.
44 const std::string &GetPrefix() const { return fPrefix; }
45 const std::vector<std::string> &GetUserDirs() const { return fUserDirs; }
46 const std::string &GetWriteDir() const { return fWriteDir; }
47 void SetWriteDir(const std::string &dir) { fWriteDir = NormalizeDir(dir); }
48 /// @}
49
50 void SetUserDir(const std::string &dir);
51 void AddUserDir(const std::string &dir);
52 void AddFallbackDir(const std::string &dir);
53
54 std::string Find(const std::string &file) const;
55 std::string FindPair(const std::string &file1, const std::string &file2) const;
56 std::string WritePath(const std::string &file) const;
57
58 void Register() const;
59 static void RegisterAll();
60};
61
62} // namespace Internal
63} // namespace Experimental
64} // namespace ROOT
65
66#endif
Directories of one kind of file the REve server serves under one http location prefix.
static std::string NormalizeDir(const std::string &dir)
Return dir with a trailing slash; an empty dir stays empty.
void SetUserDir(const std::string &dir)
Replace the user directories with dir.
void AddUserDir(const std::string &dir)
Append dir to the user directories.
REveAssetDir & operator=(const REveAssetDir &)=delete
std::vector< std::string > fUserDirs
set by the user, searched first, in order
const std::vector< std::string > & GetUserDirs() const
std::string WritePath(const std::string &file) const
Return the path to write file to, creating the write directory if it does not exist.
std::string fWriteDir
where new files are written; empty if none
REveAssetDir(const REveAssetDir &)=delete
void AddFallbackDir(const std::string &dir)
Append dir to the fallback directories.
const std::string & GetPrefix() const
Accessors; the directories passed in are normalized.
static void RegisterAll()
Register all instances. Called from the REveManager constructor.
const std::string & GetWriteDir() const
std::string fPrefix
http location prefix, such as "sdf-fonts/"
std::string Find(const std::string &file) const
Return the path of file in the first directory that has it, user directories first,...
static std::vector< REveAssetDir * > & Instances()
All existing instances, for RegisterAll().
void SetWriteDir(const std::string &dir)
REveAssetDir(const std::string &prefix)
Constructor. prefix is the http location prefix, with a trailing slash.
static std::string GetUi5Dir()
Return the directory the server maps to "rootui5sys/", found as RWebWindowsManager finds it: $ROOTUI5...
void Register() const
Pass the directories to the server, user directories first, then fallback directories,...
static std::string GetAssetsDir()
Return eve7/assets/ in the ui5 directory, where the build installs the RenderCore assets tarball.
std::string FindPair(const std::string &file1, const std::string &file2) const
Return the first directory that has file1 or file2 if it has both, else an empty string.
std::vector< std::string > fFallbackDirs
shipped with ROOT, read-only, searched after fUserDirs