MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / LoadMountFile

Method LoadMountFile

src/Core/System/MountablePath.cpp:30–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 }
29
30 void MountablePath::LoadMountFile()
31 {
32 MountablePath::MountedPaths.clear();
33 vili::node mountedPaths;
34 try
35 {
36 mountedPaths = vili::parser::from_file(
37 "Mount.vili", Config::Templates::getMountTemplates());
38 }
39 catch (std::exception& e)
40 {
41 Debug::Log->critical(
42 "<MountablePath> Unable to load 'Mount.vili' : \n{}", e.what());
43 throw Exceptions::MountFileMissing(
44 Utils::File::getCurrentDirectory(), EXC_INFO);
45 }
46 for (vili::node& path : mountedPaths.at("Mount"))
47 {
48 const std::string currentType = path.at("type");
49 const std::string currentPath = path.at("path");
50 int currentPriority = path.at("priority");
51 if (currentType == "Path")
52 {
53 MountablePath::Mount(
54 MountablePath(MountablePathType::Path, currentPath, currentPriority));
55 Debug::Log->info("<MountablePath> Mounted Path : '{0}' with priority {1}",
56 currentPath, currentPriority);
57 }
58 else if (currentType == "Package")
59 {
60 Package::Load(currentPath, currentPriority);
61 Debug::Log->info(
62 "<MountablePath> Mounted Package : '{0}' with priority {1}",
63 currentPath, currentPriority);
64 }
65 else if (currentType == "Workspace")
66 {
67 Workspace::Load(currentPath, currentPriority);
68 Debug::Log->info("<MountablePath> Mounted Workspace : '{0}' "
69 "with priority {1}",
70 currentPath, currentPriority);
71 }
72 }
73 Debug::Log->info("<MountablePath> List of mounted paths : ");
74 for (MountablePath& currentPath : MountablePath::MountedPaths)
75 {
76 Debug::Log->info("<MountablePath> MountedPath : {0}", currentPath.basePath);
77 }
78 }
79
80 void MountablePath::Mount(const MountablePath path)
81 {

Callers

nothing calls this directly

Calls 11

from_fileFunction · 0.85
getMountTemplatesFunction · 0.85
MountFileMissingClass · 0.85
getCurrentDirectoryFunction · 0.85
MountablePathClass · 0.85
criticalMethod · 0.80
infoMethod · 0.80
LoadFunction · 0.70
clearMethod · 0.45
whatMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected