本文整理汇总了C++中FilePath::GetAbsolutePathname方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::GetAbsolutePathname方法的具体用法?C++ FilePath::GetAbsolutePathname怎么用?C++ FilePath::GetAbsolutePathname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::GetAbsolutePathname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadScriptFromFile
bool AutotestingSystemLua::LoadScriptFromFile(const FilePath &luaFilePath)
{
Logger::Debug("AutotestingSystemLua::LoadScriptFromFile: %s", luaFilePath.GetAbsolutePathname().c_str());
File * file = File::Create(luaFilePath, File::OPEN | File::READ );
if (file)
{
char *data = new char[file->GetSize()];
file->Read(data, file->GetSize());
uint32 fileSize = file->GetSize();
file->Release();
file = NULL;
bool result = luaL_loadbuffer(luaState, data, fileSize, luaFilePath.GetAbsolutePathname().c_str()) == LUA_OK;
delete [] data;
if (result)
{
return true;
}
else
{
Logger::Error("AutotestingSystemLua::LoadScriptFromFile: couldn't load buffer %s", luaFilePath.GetAbsolutePathname().c_str());
//lua_pushnil(L);
return false;
}
} else {
Logger::Error("AutotestingSystemLua::LoadScriptFromFile: couldn't open %s",luaFilePath.GetAbsolutePathname().c_str());
//lua_pushnil(L);
return false;
}
}
示例2: CopyTexture
void SceneSaver::CopyTexture(const FilePath &texturePathname, Set<String> &errorLog)
{
FilePath descriptorPathname = TextureDescriptor::GetDescriptorPathname(texturePathname);
TextureDescriptor* desc = TextureDescriptor::CreateFromFile(descriptorPathname);
if(desc->IsCubeMap())
{
sceneUtils.CopyFile(descriptorPathname, errorLog);
Vector<String> faceNames;
Texture::GenerateCubeFaceNames(descriptorPathname.GetAbsolutePathname().c_str(), faceNames);
for(Vector<String>::iterator it = faceNames.begin();
it != faceNames.end();
++it)
{
sceneUtils.CopyFile(*it, errorLog);
}
}
else
{
FilePath pngPathname = GPUFamilyDescriptor::CreatePathnameForGPU(texturePathname, GPU_UNKNOWN, FORMAT_RGBA8888);
sceneUtils.CopyFile(descriptorPathname, errorLog);
sceneUtils.CopyFile(pngPathname, errorLog);
}
SafeRelease(desc);
}
示例3: Initialize
void FilePath::Initialize(const String &_pathname)
{
String pathname = NormalizePathname(_pathname);
pathType = GetPathType(pathname);
if (pathType == PATH_EMPTY)
{
absolutePathname = String();
}
else if(pathType == PATH_IN_RESOURCES || pathType == PATH_IN_MEMORY)
{
absolutePathname = pathname;
}
else if(pathType == PATH_IN_DOCUMENTS)
{
absolutePathname = GetSystemPathname(pathname, pathType);
}
else if(IsAbsolutePathname(pathname))
{
absolutePathname = pathname;
}
else
{
Logger::FrameworkDebug("[FilePath::Initialize] FilePath was initialized from relative path name (%s)", _pathname.c_str());
#if defined(__DAVAENGINE_ANDROID__)
absolutePathname = pathname;
#else //#if defined(__DAVAENGINE_ANDROID__)
FilePath path = FileSystem::Instance()->GetCurrentWorkingDirectory() + pathname;
absolutePathname = path.GetAbsolutePathname();
#endif //#if defined(__DAVAENGINE_ANDROID__)
}
}
示例4: CollectTexture
void TextureHelper::CollectTexture(Map<String, Texture *> &textures, const FilePath &name, Texture *tex)
{
if (!name.IsEmpty())
{
textures[name.GetAbsolutePathname()] = tex;
}
}
示例5: SaveTextureAction
void LandscapeEditorCustomColors::SaveTextureAction(const FilePath &pathToFile)
{
if(pathToFile.IsEmpty())
return;
if(colorSprite)
{
Image *img = colorSprite->GetTexture()->CreateImageFromMemory();
if(img)
{
StoreSaveFileName(pathToFile.GetAbsolutePathname());
ImageLoader::Save(img, pathToFile.GetAbsolutePathname());
SafeRelease(img);
unsavedChanges = false;
}
}
}
示例6: RunScriptFromFile
bool AutotestingSystemLua::RunScriptFromFile(const FilePath &luaFilePath)
{
Logger::Debug("AutotestingSystemLua::RunScriptFromFile %s", luaFilePath.GetAbsolutePathname().c_str());
if(LoadScriptFromFile(luaFilePath))
{
lua_pushstring(luaState, luaFilePath.GetBasename().c_str());
return RunScript();
}
return false;
}
示例7: FetchParametersFromIdTxt
// Get test parameters from id.tx
void AutotestingSystem::FetchParametersFromIdTxt()
{
FilePath file = "~res:/Autotesting/id.yaml";
Logger::Debug("AutotestingSystem::FetchParametersFromIdTxt %s", file.GetAbsolutePathname().c_str());
KeyedArchive *option = new KeyedArchive();
bool res = option->LoadFromYamlFile(file);
if (!res)
{
ForceQuit("Couldn't open file " + file.GetAbsolutePathname());
}
buildId = option->GetString("buildId");
buildDate = option->GetString("date");
branch = option->GetString("branch");
framework = option->GetString("framework");
branchRev = option->GetString("branchRev");
frameworkRev = option->GetString("frameworkRev");
SafeRelease(option);
}
示例8: CreateProjectPathFromPath
FilePath SceneSaver::CreateProjectPathFromPath(const FilePath & pathname)
{
String fullPath = pathname.GetAbsolutePathname();
String::size_type pos = fullPath.find("/Data");
if(pos != String::npos)
{
return fullPath.substr(0, pos+1);
}
return FilePath();
}
示例9: QDialog
CubeMapTextureBrowser::CubeMapTextureBrowser(SceneEditor2* currentScene, QWidget *parent) :
QDialog(parent),
ui(new Ui::CubeMapTextureBrowser),
cubeListItemDelegate(QSize(FACE_IMAGE_SIZE, FACE_IMAGE_SIZE))
{
scene = currentScene;
ui->setupUi(this);
ui->loadingWidget->setVisible(false);
ui->listTextures->setItemDelegate(&cubeListItemDelegate);
ConnectSignals();
FilePath projectPath = CubemapUtils::GetDialogSavedPath("Internal/CubemapLastProjDir",
ProjectManager::Instance()->CurProjectDataSourcePath().GetAbsolutePathname());
ui->textRootPath->setText(projectPath.GetAbsolutePathname().c_str());
ReloadTextures(projectPath.GetAbsolutePathname());
UpdateCheckedState();
}
示例10: ValidateTexturePathname
bool SceneValidator::ValidateTexturePathname(const FilePath &pathForValidation, Set<String> &errorsLog)
{
DVASSERT_MSG(!pathForChecking.IsEmpty(), "Need to set pathname for DataSource folder");
bool pathIsCorrect = IsPathCorrectForProject(pathForValidation);
if(pathIsCorrect)
{
String textureExtension = pathForValidation.GetExtension();
String::size_type extPosition = TextureDescriptor::GetSupportedTextureExtensions().find(textureExtension);
if(String::npos == extPosition)
{
errorsLog.insert(Format("Path %s has incorrect extension", pathForValidation.GetAbsolutePathname().c_str()));
return false;
}
}
else
{
errorsLog.insert(Format("Path %s is incorrect for project %s", pathForValidation.GetAbsolutePathname().c_str(), pathForChecking.GetAbsolutePathname().c_str()));
}
return pathIsCorrect;
}
示例11: QDialog
CubeMapTextureBrowser::CubeMapTextureBrowser(SceneEditor2* currentScene, QWidget *parent) :
QDialog(parent),
ui(new Ui::CubeMapTextureBrowser),
cubeListItemDelegate(QSize(FACE_IMAGE_SIZE, FACE_IMAGE_SIZE))
{
scene = currentScene;
ui->setupUi(this);
ui->loadingWidget->setVisible(false);
ui->listTextures->setItemDelegate(&cubeListItemDelegate);
ConnectSignals();
FilePath projectPath = CubemapUtils::GetDialogSavedPath(ResourceEditor::CUBEMAP_LAST_PROJECT_DIR_KEY,
EditorSettings::Instance()->GetDataSourcePath().GetAbsolutePathname(),
EditorSettings::Instance()->GetDataSourcePath().GetAbsolutePathname());
ui->textRootPath->setText(projectPath.GetAbsolutePathname().c_str());
ReloadTextures(projectPath.GetAbsolutePathname());
UpdateCheckedState();
}
示例12: Read
bool PngImageExt::Read(const FilePath & filename)
{
SafeRelease(internalData);
internalData = new Image();
int32 retCode = LibPngWrapper::ReadPngFile(filename, internalData, FORMAT_RGBA8888);
if(1 != retCode)
{
Logger::Error("[PngImageExt::Read] failed to open png file: %s", filename.GetAbsolutePathname().c_str());
SafeRelease(internalData);
}
return (internalData != NULL);
}
示例13: PrepareFolderForCopyFile
void SceneUtils::PrepareFolderForCopyFile(const String &filename, Set<String> &errorLog)
{
FilePath newFolderPath = (dataFolder + filename).GetDirectory();
if(!FileSystem::Instance()->IsDirectory(newFolderPath))
{
FileSystem::eCreateDirectoryResult retCreate = FileSystem::Instance()->CreateDirectory(newFolderPath, true);
if(FileSystem::DIRECTORY_CANT_CREATE == retCreate)
{
errorLog.insert(String(Format("Can't create folder %s", newFolderPath.GetAbsolutePathname().c_str())));
}
}
FileSystem::Instance()->DeleteFile(dataFolder + filename);
}
示例14: SaveTexture
void VisibilityToolPanel::SaveTexture()
{
FilePath currentPath = FileSystem::Instance()->GetUserDocumentsPath();
QString filePath = QtFileDialog::getSaveFileName(NULL,
QString(ResourceEditor::VISIBILITY_TOOL_SAVE_CAPTION.c_str()),
QString(currentPath.GetAbsolutePathname().c_str()),
QString(ResourceEditor::VISIBILITY_TOOL_FILE_FILTER.c_str()));
FilePath selectedPathname = PathnameToDAVAStyle(filePath);
if(!selectedPathname.IsEmpty())
{
GetActiveScene()->visibilityToolSystem->SaveTexture(selectedPathname);
}
}
示例15: ValidateHeightmapPathname
bool SceneValidator::ValidateHeightmapPathname(const FilePath &pathForValidation, Set<String> &errorsLog)
{
DVASSERT_MSG(!pathForChecking.IsEmpty(), "Need to set pathname for DataSource folder");
bool pathIsCorrect = IsPathCorrectForProject(pathForValidation);
if(pathIsCorrect)
{
String::size_type posPng = pathForValidation.GetAbsolutePathname().find(".png");
String::size_type posHeightmap = pathForValidation.GetAbsolutePathname().find(Heightmap::FileExtension());
pathIsCorrect = ((String::npos != posPng) || (String::npos != posHeightmap));
if(!pathIsCorrect)
{
errorsLog.insert(Format("Heightmap path %s is wrong", pathForValidation.GetAbsolutePathname().c_str()));
return false;
}
Heightmap *heightmap = new Heightmap();
if(String::npos != posPng)
{
Image *image = CreateTopLevelImage(pathForValidation);
pathIsCorrect = heightmap->BuildFromImage(image);
SafeRelease(image);
}
else
{
pathIsCorrect = heightmap->Load(pathForValidation);
}
if(!pathIsCorrect)
{
SafeRelease(heightmap);
errorsLog.insert(Format("Can't load Heightmap from path %s", pathForValidation.GetAbsolutePathname().c_str()));
return false;
}
pathIsCorrect = IsPowerOf2(heightmap->Size() - 1);
if(!pathIsCorrect)
{
errorsLog.insert(Format("Heightmap %s has wrong size", pathForValidation.GetAbsolutePathname().c_str()));
}
SafeRelease(heightmap);
return pathIsCorrect;
}
else
{
errorsLog.insert(Format("Path %s is incorrect for project %s", pathForValidation.GetAbsolutePathname().c_str(), pathForChecking.GetAbsolutePathname().c_str()));
}
return pathIsCorrect;
}