Jump to content

[SOLVED] property file path to disk


photo

Recommended Posts

How to get the path of a property file to disk?

the given code does not allow to get the path to the property file

    int prop_count=node->getNumProperties();
	for (int j = 0; j < prop_count; j++)
       {
        if(auto prop = node->getProperty(j))
  		{
  			std::string name_prop=prop->getName();//return property name 
            std::string path_prop=prop->getPath(); //causes an error
      		Unigine::UGUID file_guid=prop->getFileGUID(); //returns a empty guid
      		Unigine::UGUID guid=prop->getGUID(); // not empty guid but I can’t get the path 
      		
       		Unigine::String path= Unigine::FileSystem::get()->getAbsolutePath(guid);//return guid as string, but not path
        }
      }
      

moreover,  std::string path_prop=prop->getPath();  the use causes an error

image.png.8d28868e696816796894ef5f7fd7e78d.png

image.png

Link to comment

Hello Vladimir,

Each assigned to the node property is a child of a parent property and kept in the XML. To implement planned you need to find the parent first, like this:

if (PropertyPtr parent = property->getParent())
{
	Log::message("property name %s\n", parent->getName());
	Log::message("property file guid %s\n", parent->getFileGUID().getFileSystemString());
	Log::message("property abs path %s\n", FileSystem::get()->getAbsolutePath(parent->getFileGUID()).get());
}

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • morbid changed the title to [SOLVED] property file path to disk
×
×
  • Create New...