| 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 | { |
nothing calls this directly
no test coverage detected