本文整理汇总了C++中poco::Path::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::clear方法的具体用法?C++ Path::clear怎么用?C++ Path::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::Path
的用法示例。
在下文中一共展示了Path::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
std::string BuildVer(BUILD_VERSION);
cout<<"FastCraft Minecraft Server"<<"\n";
cout<<"Version "<<BUILD_VERSION<<(BuildVer.compare("") == 0 ? "" : "-")<<FC_VERSION<<" for Minecraft "<<FC_SUPPORTED_MINCRAFTVERSION<<"\n"<<std::endl;
Poco::Path pathRoot(argv[0]);
pathRoot.setFileName(""); //Remove filename
pathRoot.pushDirectory("Server");
Poco::File fileRootDirectory(pathRoot.toString());
if (!fileRootDirectory.exists()) {
try {
fileRootDirectory.createDirectories();
}catch(Poco::FileException& ex) {
cout<<"Unable to create server directory ("<<ex.message()<<")"<<std::endl;
}
}else{
if ((!fileRootDirectory.canRead()) || (!fileRootDirectory.canWrite())) {
cout<<"Unable to read or write FastCraft root directory"<<std::endl;
Thread::sleep(3000);
return 0;
}
}
std::vector<MinecraftServer*> vpServer(0);
std::vector<Poco::File> vFileList(0);
fileRootDirectory.list(vFileList);
if (vFileList.empty()) {
cout<<"No server configurations found!"<<std::endl;
Thread::sleep(3000);
return 0;
}
Poco::Data::SQLite::Connector::registerConnector(); //Startup sqlite engine
Constants::init(); //load constants
MinecraftServer* pServer;
Poco::Path pathTemp;
int x;
//Start all server
for (x=0;x<=vFileList.size()-1;x++) {
if (!vFileList[x].isDirectory()) {continue;} //Skip files
if(!pathTemp.tryParse(vFileList[x].path())) {
cout<<"Illegal path!"<<std::endl;
Thread::sleep(3000);
return 0;
}
try {
cout<<"Starting "<<pathTemp[pathTemp.depth()]<<"\n";
pathTemp.pushDirectory(pathTemp[pathTemp.depth()]);
pathTemp.setFileName("");
pServer = new MinecraftServer(pathTemp[pathTemp.depth()-1],pathTemp);
}catch(Poco::RuntimeException& ex) {
cout<<"Unable to start server ("<<ex.message()<<")"<<std::endl;
Thread::sleep(3000);
return 0;
}
vpServer.push_back(pServer);
pathTemp.clear();
}
cout<<"Loading done!\n";
bool fSomethingRuns = false;
while(1) {
Thread::sleep(1000);
//Check if there is at least one server that runs
fSomethingRuns=false;
for (x=0;x<=vpServer.size()-1;x++) {
if (vpServer[x]->isRunning()) {
fSomethingRuns=true;
break;
}
}
if (!fSomethingRuns) {break;}
}
Poco::Data::SQLite::Connector::unregisterConnector();
return 1;
}