本文整理汇总了C++中FileManager::packageShip方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::packageShip方法的具体用法?C++ FileManager::packageShip怎么用?C++ FileManager::packageShip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::packageShip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
Zipper *zipper = new GuiZipper();
FileManager *fileManager = new FileManager(zipper);
CliPackageReporter *packageReporter = new CliPackageReporter();
fileManager->setListener(packageReporter);
char *shipsBaseDir = fileManager->getAbsFilePath(SHIPS_SUBDIR);
char *stagesBaseDir = fileManager->getAbsFilePath(STAGES_SUBDIR);
if (flagExists(argc, argv, "packstage")) {
char **stageInfo = parseFlag(argc, argv, "packstage", 2);
if (stageInfo == 0) {
printUsage();
} else {
// TODO: add a new flag for obfuscating source code
bool obfuscate = false;
try {
char *stageAbsName = fileManager->getAbsFilePath(stageInfo[0]);
char *stageName =
fileManager->parseRelativeFilePath(stagesBaseDir, stageAbsName);
if (stageName == 0) {
std::cout << "Stage must be located under " << STAGES_SUBDIR
<< "/ subdirectory: " << stageInfo[0] << std::endl;
} else {
fileManager->packageStage(stagesBaseDir, stageName, stageInfo[1],
CACHE_SUBDIR, TMP_SUBDIR, obfuscate, true);
delete stageName;
}
delete stageAbsName;
} catch (std::exception *e) {
std::cout << "BerryBots encountered an error:" << std::endl;
std::cout << " " << e->what() << std::endl;
delete e;
}
delete stageInfo;
}
return 0;
}
if (flagExists(argc, argv, "packbot")) {
char **shipInfo = parseFlag(argc, argv, "packbot", 2);
if (shipInfo == 0) {
printUsage();
} else {
// TODO: add a new flag for obfuscating source code
bool obfuscate = false;
try {
char *shipAbsName = fileManager->getAbsFilePath(shipInfo[0]);
char *shipName =
fileManager->parseRelativeFilePath(shipsBaseDir, shipAbsName);
if (shipName == 0) {
std::cout << "Ship must be located under " << SHIPS_SUBDIR
<< "/ subdirectory: " << shipInfo[0] << std::endl;
} else {
fileManager->packageShip(shipsBaseDir, shipName, shipInfo[1],
CACHE_SUBDIR, TMP_SUBDIR, obfuscate, true);
delete shipName;
}
delete shipAbsName;
} catch (std::exception *e) {
std::cout << "BerryBots encountered an error:" << std::endl;
std::cout << " " << e->what() << std::endl;
delete e;
}
delete shipInfo;
}
return 0;
}
bool nodisplay = flagExists(argc, argv, "nodisplay");
bool saveReplay = flagExists(argc, argv, "savereplay");
int optArgsOffset = (nodisplay ? 1 : 0) + (saveReplay ? 1 : 0);
if (argc < 3 + optArgsOffset) {
printUsage();
}
srand(time(NULL));
CliPrintHandler *printHandler = new CliPrintHandler();
BerryBotsEngine *engine =
new BerryBotsEngine(printHandler, fileManager, resourcePath().c_str());
Stage *stage = engine->getStage();
char *stageAbsName = fileManager->getAbsFilePath(argv[1 + optArgsOffset]);
char *stageName =
fileManager->parseRelativeFilePath(stagesBaseDir, stageAbsName);
if (stageName == 0) {
std::cout << "Stage must be located under " << STAGES_SUBDIR
<< "/ subdirectory: " << argv[1 + optArgsOffset] << std::endl;
return 0;
}
try {
engine->initStage(stagesBaseDir, stageName, CACHE_SUBDIR);
} catch (EngineException *e) {
delete stageAbsName;
delete stageName;
std::cout << "BerryBots initialization failed:" << std::endl;
std::cout << " " << e->what() << std::endl;
delete e;
return 0;
}
//.........这里部分代码省略.........