本文整理汇总了C++中FilePath::GetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::GetDirectory方法的具体用法?C++ FilePath::GetDirectory怎么用?C++ FilePath::GetDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::GetDirectory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OnCreateCubemapClicked
void CubeMapTextureBrowser::OnCreateCubemapClicked()
{
QString fileName = QtFileDialog::getSaveFileName(this,
tr("Create Cubemap Texture"),
ui->textRootPath->text(),
tr("Tex File (*.tex)"));
if(!fileName.isNull())
{
CubemapEditorDialog dlg(this);
FilePath fp = fileName.toStdString();
DAVA::FilePath rootPath = fp.GetDirectory();
dlg.InitForCreating(fp, rootPath);
dlg.exec();
QString path = rootPath.GetAbsolutePathname().c_str();
ui->textRootPath->setText(path);
int currentRow = ui->listTextures->currentRow();
ReloadTexturesFromUI(path);
if(ui->listTextures->count() > 0 &&
currentRow < ui->listTextures->count())
{
RestoreListSelection(currentRow);
}
}
}
示例3: LoadFromYaml
bool Shader::LoadFromYaml(const FilePath & pathname)
{
//#if defined(__DAVAENGINE_ANDROID__) || defined (__DAVAENGINE_MACOS__)
// relativeFileName = pathname;
//#endif //#if defined(__DAVAENGINE_ANDROID__)
uint64 shaderLoadTime = SystemTimer::Instance()->AbsoluteMS();
YamlParser * parser = YamlParser::Create(pathname);
if (!parser)
return false;
YamlNode * rootNode = parser->GetRootNode();
if (!rootNode)
{
SafeRelease(rootNode);
return false;
}
const YamlNode * vertexShaderNode = rootNode->Get("vertexShader");
if (!vertexShaderNode)
{
SafeRelease(parser);
return false;
}
const YamlNode * glslVertexNode = vertexShaderNode->Get("glsl");
if (!glslVertexNode)
{
SafeRelease(parser);
return false;
}
const YamlNode * fragmentShaderNode = rootNode->Get("fragmentShader");
if (!fragmentShaderNode)
{
SafeRelease(parser);
return false;
}
const YamlNode * glslFragmentNode = fragmentShaderNode->Get("glsl");
if (!glslFragmentNode)
{
SafeRelease(parser);
return false;
}
FilePath pathOnly(pathname.GetDirectory());
vertexShaderPath = pathOnly + glslVertexNode->AsString();
fragmentShaderPath = pathOnly + glslFragmentNode->AsString();
SafeRelease(parser);
Load(vertexShaderPath, fragmentShaderPath);
shaderLoadTime = SystemTimer::Instance()->AbsoluteMS() - shaderLoadTime;
// Logger::FrameworkDebug("shader loaded:%s load-time: %lld ms", pathname.c_str(), shaderLoadTime);
return true;
}
示例4: AbsoluteToRelative
String FilePath::AbsoluteToRelative(const FilePath &directoryPathname, const FilePath &absolutePathname)
{
if(absolutePathname.IsEmpty())
return String();
DVASSERT(directoryPathname.IsDirectoryPathname());
Vector<String> folders;
Vector<String> fileFolders;
if(directoryPathname.GetType() == PATH_IN_RESOURCES && absolutePathname.GetType() == PATH_IN_RESOURCES)
{
Split(directoryPathname.absolutePathname, "/", folders);
Split(absolutePathname.GetDirectory().absolutePathname, "/", fileFolders);
}
else
{
Split(directoryPathname.GetAbsolutePathname(), "/", folders);
Split(absolutePathname.GetDirectory().GetAbsolutePathname(), "/", fileFolders);
}
Vector<String>::size_type equalCount = 0;
for(; equalCount < folders.size() && equalCount < fileFolders.size(); ++equalCount)
{
if(folders[equalCount] != fileFolders[equalCount])
{
break;
}
}
String retPath = "";
for(Vector<String>::size_type i = equalCount; i < folders.size(); ++i)
{
retPath += "../";
}
for(Vector<String>::size_type i = equalCount; i < fileFolders.size(); ++i)
{
retPath += fileFolders[i] + "/";
}
return (retPath + absolutePathname.GetFilename());
}
示例5: SplitImage
bool ImageSplitter::SplitImage(const FilePath &pathname, Set<String> &errorLog)
{
Image *loadedImage = CreateTopLevelImage(pathname);
if(!loadedImage)
{
errorLog.insert(String(Format("Can't load image %s", pathname.GetAbsolutePathname().c_str())));
return false;
}
if(loadedImage->GetPixelFormat() != FORMAT_RGBA8888)
{
errorLog.insert(String(Format("Incorrect image format %s. Must be RGBA8888", Texture::GetPixelFormatString(loadedImage->GetPixelFormat()))));
return false;
}
Image *red = Image::Create(loadedImage->width, loadedImage->height, FORMAT_A8);
Image *green = Image::Create(loadedImage->width, loadedImage->height, FORMAT_A8);
Image *blue = Image::Create(loadedImage->width, loadedImage->height, FORMAT_A8);
Image *alpha = Image::Create(loadedImage->width, loadedImage->height, FORMAT_A8);
int32 size = loadedImage->width * loadedImage->height;
int32 pixelSize = Texture::GetPixelFormatSizeInBytes(FORMAT_RGBA8888);
for(int32 i = 0; i < size; ++i)
{
int32 offset = i * pixelSize;
red->data[i] = loadedImage->data[offset];
green->data[i] = loadedImage->data[offset + 1];
blue->data[i] = loadedImage->data[offset + 2];
alpha->data[i] = loadedImage->data[offset + 3];
}
FilePath folder(pathname.GetDirectory());
SaveImage(red, folder + "r.png");
SaveImage(green, folder + "g.png");
SaveImage(blue, folder + "b.png");
SaveImage(alpha, folder + "a.png");
ReleaseImages(red, green, blue, alpha);
SafeRelease(loadedImage);
return true;
}
示例6: LoadImageFromUserFile
void CubemapEditorDialog::LoadImageFromUserFile(float rotation, int face)
{
FilePath projectPath = CubemapUtils::GetDialogSavedPath("Internal/CubemapLastFaceDir",
ProjectManager::Instance()->CurProjectDataSourcePath().GetAbsolutePathname());
QString fileName = QtFileDialog::getOpenFileName(this,
tr("Open Cubemap Face Image"),
QString::fromStdString(projectPath.GetAbsolutePathname()),
tr("Image Files (*.png)"));
if(!fileName.isNull())
{
String stdFilePath = fileName.toStdString();
LoadImageTo(stdFilePath, face, false);
projectPath = stdFilePath;
SettingsManager::SetValue(Settings::Internal_CubemapLastFaceDir, VariantType(projectPath.GetDirectory()));
if(AllFacesLoaded())
{
ui->legend->setVisible(false);
}
}
}
示例7: path
rstream.Release();
Console::GetDefault()->Out->WriteLine(String::Format("Success! Read back 0x%08x, \"%s\", and 0x%04x from file.", num, str.CString(), num2));
// rstream and reader are both Released() when this returns thanks to AutoPointer.
Console::GetDefault()->Out->WriteLine(" --- File Path Test --- ");
Console::GetDefault()->Out->WriteLine("Creating FilePath, should be /test/lol/sup");
FilePath path("lol");
path = path.Combine("sup");
path = path.RootPath("/test");
#if !BRICKS_ENV_WINDOWS
BRICKS_FEATURE_ASSERT(path == "/test/lol/sup");
#endif
Console::GetDefault()->Out->WriteLine(String::Format("Result: %s, filename is %s", path.CString(), path.GetFileName().CString()));
Console::GetDefault()->Out->WriteLine(String::Format("Directory is: %s", path.GetDirectory().CString()));
Console::GetDefault()->Out->WriteLine(" --- Directory Iteration Test --- ");
Console::GetDefault()->Out->WriteLine("Listing contents of current directory...");
AutoPointer<FileNode> node = autonew FilesystemNode("."); // current dir
#if BRICKS_CONFIG_CPP0X
node->Iterate([](FileNode* subnode) -> bool {
Console::GetDefault()->Out->WriteLine(String::Format("Subfile: %s", subnode->GetName().CString()));
return true; // returning false is like break;ing out of the loop.
});
#else
foreach (FileNode* subnode, node) {
Console::GetDefault()->Out->WriteLine(String::Format("Subfile: %s", subnode->GetName().CString()));
}
#endif
}
示例8: GetScenePath
FilePath LandscapeEditorCustomColors::GetScenePath()
{
FilePath sceneFilePath = SceneDataManager::Instance()->SceneGetActive()->GetScenePathname();
return FilePath(sceneFilePath.GetDirectory());
}