本文整理汇总了C++中FileManager::DoesFileExist方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::DoesFileExist方法的具体用法?C++ FileManager::DoesFileExist怎么用?C++ FileManager::DoesFileExist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::DoesFileExist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxStaticText
//------------------------------------------------------------------------------
AboutDialog::AboutDialog(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style)
: wxDialog(parent, id, title, pos, size, style, title)
{
#ifdef DEBUG_ICONFILE
MessageInterface::ShowMessage("AboutDialog::AboutDialog() entered\n");
#endif
wxBitmap bitmap;
wxBitmapButton *aboutButton;
// if icon file available, use it
FileManager *fm = FileManager::Instance();
std::string iconFile = (fm->GetFullPathname("ICON_PATH") + "GMATAboutIcon.png");
#ifdef DEBUG_ICONFILE
MessageInterface::ShowMessage(" About iconFile='%s'\n", iconFile.c_str());
#endif
if (fm->DoesFileExist(iconFile))
{
//bitmap.LoadFile(iconFile.c_str(), wxBITMAP_TYPE_JPEG);
bitmap.LoadFile(iconFile.c_str(), wxBITMAP_TYPE_PNG);
wxImage image = bitmap.ConvertToImage();
#ifdef DEBUG_ICONFILE
MessageInterface::ShowMessage(" Scaling and creating bitmap button\n");
#endif
bitmap = wxBitmap(image.Scale(100, 100), wxIMAGE_QUALITY_HIGH);
aboutButton = new wxBitmapButton(this, -1, bitmap, wxDefaultPosition,
wxSize(100, 100), wxBORDER_NONE);
}
else
{
MessageInterface::ShowMessage
("About GMAT icon file '%s' does not exist.\n", iconFile.c_str());
aboutButton = new wxBitmapButton(this, -1, NULL, wxDefaultPosition,
wxSize(100, 100));
}
#ifdef DEBUG_ICONFILE
MessageInterface::ShowMessage(" Bitmap button created\n");
#endif
wxColourDatabase cdb;
wxColour gmatColor = cdb.Find("NAVY");
wxStaticLine *line1 = new wxStaticLine(this);
wxStaticLine *line2 = new wxStaticLine(this);
// title, build date
wxStaticText *gmatText =
new wxStaticText(this, -1, "General Mission Analysis Tool");
wxFont font1 = wxFont();
#ifdef __WXMAC__
font1.SetPointSize(20);
#else
font1.SetPointSize(11);
#endif
font1.SetWeight(wxFONTWEIGHT_BOLD);
gmatText->SetOwnFont(font1);
gmatText->SetOwnForegroundColour(gmatColor);
wxString buildDate;
buildDate.Printf("Build Date: %s %s\n", __DATE__, __TIME__);
wxStaticText *buildText = new wxStaticText(this, -1, buildDate);
#ifdef __WXMAC__
font1.SetPointSize(12);
#else
font1.SetPointSize(8);
#endif
font1.SetWeight(wxFONTWEIGHT_LIGHT);
buildText->SetFont(font1);
// website and contact email
wxStaticText *webText = new wxStaticText(this, -1, "Website: ");
wxString gmatUrl = "http://gmat.gsfc.nasa.gov";
wxHyperlinkCtrl *webLink = new wxHyperlinkCtrl(this, -1, gmatUrl, gmatUrl);
wxStaticText *contactText = new wxStaticText(this, -1, "Contact: ");
wxStaticText *emailText = new wxStaticText(this, -1, "[email protected]");
wxFlexGridSizer *contactSizer = new wxFlexGridSizer(2);
contactSizer->Add(webText, 0, wxALIGN_RIGHT|wxALL, 2);
contactSizer->Add(webLink, 0, wxALIGN_LEFT|wxALL, 2);
contactSizer->Add(contactText, 0, wxALIGN_RIGHT|wxALL, 2);
contactSizer->Add(emailText, 0, wxALIGN_LEFT|wxALL, 2);
wxBoxSizer *gmatSizer = new wxBoxSizer(wxVERTICAL);
gmatSizer->Add(gmatText, 0, wxALIGN_CENTRE|wxALL, 4);
gmatSizer->Add(buildText, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT, 4);
gmatSizer->Add(3, 3);
gmatSizer->Add(contactSizer, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT, 4);
wxBoxSizer *topSizer = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(aboutButton, 0, wxALIGN_CENTRE|wxALL, 4);
topSizer->Add(gmatSizer, 0, wxALIGN_CENTRE|wxALL, 4);
// licence and thrid party
//.........这里部分代码省略.........
示例2: LoadFluxData
//------------------------------------------------------------------------------
bool SolarFluxReader::LoadFluxData(const std::string &obsFile, const std::string &predictFile)
{
std::string theLine;
if (!obsFile.empty())
obsFileName = obsFile;
if (!predictFile.empty())
predictFileName = predictFile;
obsFluxData.clear();
predictFluxData.clear();
FileManager *fm = FileManager::Instance();
if (obsFileName != "")
{
std::string weatherfile = obsFileName;
if (fm->DoesFileExist(weatherfile) == false)
weatherfile = fm->GetAbsPathname("ATMOSPHERE_PATH") + weatherfile;
if (fm->DoesFileExist(weatherfile) == false)
throw SolarSystemException("Cannot open the historic space weather file " +
obsFileName + ", nor the file at the location " + weatherfile);
obsFileName = weatherfile;
}
if (predictFileName != "")
{
std::string weatherfile = predictFileName;
if (fm->DoesFileExist(weatherfile) == false)
weatherfile = fm->GetAbsPathname("ATMOSPHERE_PATH") + weatherfile;
if (fm->DoesFileExist(weatherfile) == false)
throw SolarSystemException("Cannot open the predicted space weather file " +
predictFileName + ", nor the file at the location " + weatherfile);
predictFileName = weatherfile;
}
// Open the files to load
Open();
if (obsFileName != "")
{
if (inObs.is_open())
{
inObs.seekg(0, std::ios_base::beg);
while (!inObs.eof())
{
GmatFileUtil::GetLine(&inObs, theLine);
if (theLine.find(beg_ObsTag) != std::string::npos)
{
begObs = inObs.tellg();
}
else if (theLine.find(end_ObsTag) != std::string::npos)
{
endObs = inObs.tellg();
endObs = endObs - theLine.length() - 2;
break;
}
}
LoadObsData();
}
else
{
//throw an exception
throw SolarSystemException("SolarFluxReader: Historic/Observed File " +
obsFileName + " could not be opened.\n");
}
}
if (predictFileName != "")
{
if (inPredict.is_open())
{
inPredict.seekg(0, std::ios_base::beg);
while (!inPredict.eof())
{
GmatFileUtil::GetLine(&inPredict, theLine);
if ((theLine.find("NOMINAL TIMING") != std::string::npos) &&
(theLine.find("EARLY TIMING") != std::string::npos))
{
GmatFileUtil::GetLine(&inPredict, theLine);
break;
}
}
LoadPredictData();
}
else
{
//throw an exception
throw SolarSystemException("SolarFluxReader: The Schatten predict "
"file " + predictFileName + " could not be opened.\n");
}
}
#ifdef DEBUG_INITIALIZATION
//.........这里部分代码省略.........