本文整理汇总了C++中FilePath::Exists方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::Exists方法的具体用法?C++ FilePath::Exists怎么用?C++ FilePath::Exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::Exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultPath
AddSwitchEntityDialog::AddSwitchEntityDialog( QWidget* parent)
:BaseAddEntityDialog(parent, QDialogButtonBox::Ok | QDialogButtonBox::Cancel)
{
setAcceptDrops(true);
setAttribute( Qt::WA_DeleteOnClose, true );
FilePath defaultPath(ProjectManager::Instance()->CurProjectDataSourcePath());
SceneEditor2 *scene = QtMainWindow::Instance()->GetCurrentScene();
if(scene)
{
FilePath scenePath = scene->GetScenePath();
if(scenePath.Exists())
{
defaultPath = scenePath.GetDirectory();
}
}
SelectEntityPathWidget* firstWidget = new SelectEntityPathWidget(parent, defaultPath.GetAbsolutePathname(),"");
SelectEntityPathWidget* secondWidget = new SelectEntityPathWidget(parent, defaultPath.GetAbsolutePathname(),"");
SelectEntityPathWidget* thirdWidget = new SelectEntityPathWidget(parent, defaultPath.GetAbsolutePathname(),"");
AddControlToUserContainer(firstWidget, "First Entity:");
AddControlToUserContainer(secondWidget, "Second Entity:");
AddControlToUserContainer(thirdWidget, "Third Entity:");
pathWidgets.push_back(firstWidget);
pathWidgets.push_back(secondWidget);
pathWidgets.push_back(thirdWidget);
propEditor->setVisible(false);
propEditor->setMinimumHeight(0);
propEditor->setMaximumSize(propEditor->maximumWidth(), 0);
}
示例2: GetMutableBaseDirectory
/// Get the full path to the base directory of the application.
///
/// @param[out] rbSuccess True if the path was retrieved successfully, false if not.
///
/// @return Application base directory path, with a trailing path separator character.
static FilePath& GetMutableBaseDirectory( bool& rbSuccess )
{
static FilePath baseDirectory;
static bool bLocateRequested = false;
static bool bLocateSuccess = false;
rbSuccess = bLocateSuccess;
if( !bLocateRequested )
{
bLocateRequested = true;
baseDirectory.Set( Helium::GetProcessPath() );
// Strip the executable file.
// Strip the configuration type subdirectory (i.e. Debug, Intermediate, Release, etc.).
// Strip the platform binary subdirectory (i.e. x32, x64).
// Strip the "Bin" directory.
baseDirectory.Set( baseDirectory.Directory() + TXT( "../../.." ) );
if( !baseDirectory.Exists() )
{
baseDirectory.Clear();
return baseDirectory;
}
baseDirectory += TXT( "/" );
bLocateSuccess = true;
rbSuccess = true;
}
return baseDirectory;
}
示例3: EnumerateModifiedTextures
int32 SceneHelper::EnumerateModifiedTextures(DAVA::Scene *forScene, DAVA::Map<DAVA::Texture *, DAVA::Vector< DAVA::eGPUFamily> > &textures)
{
int32 retValue = 0;
textures.clear();
TexturesMap allTextures;
EnumerateSceneTextures(forScene, allTextures, EXCLUDE_NULL);
for(TexturesMap::iterator it = allTextures.begin(); it != allTextures.end(); ++it)
{
DAVA::Texture * texture = it->second;
if(NULL == texture)
{
continue;
}
DAVA::TextureDescriptor *descriptor = texture->GetDescriptor();
if(NULL == descriptor)
{
continue;
}
DVASSERT(descriptor->compression);
DAVA::Vector< DAVA::eGPUFamily> markedGPUs;
for(int i = 0; i < DAVA::GPU_DEVICE_COUNT; ++i)
{
eGPUFamily gpu = (eGPUFamily)i;
if(GPUFamilyDescriptor::IsFormatSupported(gpu, (PixelFormat)descriptor->compression[gpu].format))
{
FilePath texPath = descriptor->GetSourceTexturePathname();
if(texPath.Exists() && !descriptor->IsCompressedTextureActual(gpu))
{
markedGPUs.push_back(gpu);
retValue++;
}
}
}
if(markedGPUs.size() > 0)
{
textures[texture] = markedGPUs;
}
}
return retValue;
}
示例4: GetMutableDataDirectory
/// Get the full path to the base directory in which data files are stored.
///
/// @param[out] rbSuccess True if the path was retrieved successfully, false if not.
///
/// @return Data directory path, with a trailing path separator character.
static FilePath& GetMutableDataDirectory( bool& rbSuccess )
{
static FilePath dataDirectory;
static bool bLocateRequested = false;
static bool bLocateSuccess = false;
rbSuccess = bLocateSuccess;
if( !bLocateRequested )
{
bLocateRequested = true;
// Get the application base directory.
bool bBaseDirectorySuccess;
dataDirectory = GetMutableBaseDirectory( bBaseDirectorySuccess );
if( !bBaseDirectorySuccess )
{
dataDirectory.Clear();
return dataDirectory;
}
dataDirectory += TXT( "Data" );
if( !dataDirectory.Exists() )
{
dataDirectory.Clear();
return dataDirectory;
}
dataDirectory += TXT( "/" );
bLocateSuccess = true;
rbSuccess = true;
}
return dataDirectory;
}
示例5: OnDeleteSelectedItemsClicked
void CubeMapTextureBrowser::OnDeleteSelectedItemsClicked()
{
int checkedItemCount = GetCheckedItemsCount();
int answer = MB_FLAG_NO;
if(checkedItemCount > 0)
{
QString text = QString("%1 item(s) will be deleted. Continue?").arg(QString().setNum(checkedItemCount));
answer = ShowQuestion("Confirmation",
text.toStdString(),
MB_FLAG_YES | MB_FLAG_NO,
MB_FLAG_NO);
}
if(MB_FLAG_YES == answer)
{
DAVA::Vector<DAVA::String> failedToRemove;
int itemCount = ui->listTextures->count();
for(int i = 0; i < itemCount; ++i)
{
QListWidgetItem* item = ui->listTextures->item(i);
bool checkedState = item->data(Qt::CheckStateRole).toBool();
if(checkedState)
{
FilePath fp = item->data(CUBELIST_DELEGATE_ITEMFULLPATH).toString().toStdString();
if(fp.Exists())
{
DAVA::Vector<DAVA::String> faceNames;
CubemapUtils::GenerateFaceNames(fp.GetAbsolutePathname(), faceNames);
for(size_t faceIndex = 0; faceIndex < faceNames.size(); ++faceIndex)
{
FilePath hackTex = faceNames[faceIndex];
hackTex.ReplaceExtension(".tex");
QFile::remove(hackTex.GetAbsolutePathname().c_str());
bool removeResult = QFile::remove(faceNames[faceIndex].c_str());
if(!removeResult)
{
failedToRemove.push_back(faceNames[faceIndex]);
}
}
bool removeResult = QFile::remove(fp.GetAbsolutePathname().c_str());
if(!removeResult)
{
failedToRemove.push_back(fp.GetAbsolutePathname().c_str());
}
}
}
}
if(failedToRemove.size() > 0)
{
DAVA::String fileList;
int count = failedToRemove.size();
for(int i = 0; i < count; ++i)
{
fileList += failedToRemove[i];
fileList += "\n";
}
DAVA::String message = "Failed to remove the following files. Please delete them manually.\n";
message += fileList;
ShowErrorDialog(message);
}
QString path = ui->textRootPath->text();
ReloadTexturesFromUI(path);
UpdateCheckedState();
}
}