MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / openMapFromArchive

Method openMapFromArchive

radiantcore/map/Map.cpp:1132–1156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1130}
1131
1132void Map::openMapFromArchive(const cmd::ArgumentList& args)
1133{
1134 if (args.size() != 2)
1135 {
1136 rWarning() << "Usage: OpenMapFromArchive <pathToPakFile> <pathWithinArchive>" << std::endl;
1137 return;
1138 }
1139
1140 if (!GlobalMap().askForSave(_("Open Map"))) return;
1141
1142 std::string pathToArchive = args[0].getString();
1143 std::string relativePath = args[1].getString();
1144
1145 if (!os::fileOrDirExists(pathToArchive))
1146 {
1147 throw cmd::ExecutionFailure(fmt::format(_("File not found: {0}"), pathToArchive));
1148 }
1149
1150 if (!pathToArchive.empty())
1151 {
1152 GlobalMap().freeMap();
1153 GlobalMap().setMapName(relativePath);
1154 GlobalMap().loadMapResourceFromArchive(pathToArchive, relativePath);
1155 }
1156}
1157
1158void Map::importMap(const cmd::ArgumentList& args)
1159{

Callers

nothing calls this directly

Calls 12

rWarningFunction · 0.85
fileOrDirExistsFunction · 0.85
ExecutionFailureClass · 0.85
freeMapMethod · 0.80
setMapNameMethod · 0.80
_Function · 0.50
formatFunction · 0.50
sizeMethod · 0.45
askForSaveMethod · 0.45
getStringMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected