Jump to content

Dir/File class does not use virtual-fs


photo

Recommended Posts

On unigine version v1 this classes not using unigine virtual-fs as base for realtive paths resolving, that gives us a lot of trouble. Maybe we do something wrong?

Link to comment

Of course =)

 

In ++ code we are adding some directories to unigine vfs system because our projects are modular. Something like this:

FileSystem::addDirectory("../");
FileSystem::addDirectory("../../extern/");
FileSystem::addDirectory("../../common/");
FileSystem::addDirectory("../../groups/");
FileSystem::addDirectory(DEV_RESOURCES_DIR);

And then from scripts we are trying to access files/folders by relative (i.e. omitting "../../common/data/" for example) paths. This works from resource xmls like *.node, *.mat etc, but not works from scripts/cpp.

 

Also, editor saves all paths relative to the real-fs and we must call bash script with regexp replace "(\.\./)+[^<>:\"/\\|?*]+/data/" to fix paths all the time. =(

Link to comment

Hi!

 

As far as I understand, you have a lot of assets outside of data folder?

 

For correct engine work you should keep all assets inside the data directory. If there is no such possibility, you can use extern_path command to "extend" data directory. Please, check this documentation if you are using Unigine 2.0: https://developer.unigine.com/en/docs/1.0/principles/filesystem/#data_dir

For Unigine 1.0 you can use extern_directory: http://old-docs.developer.unigine.com/principles/filesystem/#data_dir

 

You also can use multiple extern directories at once, just use comma to separate them.

 

Thanks!

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

Link to comment

"FileSystem::addDirectory" do the same thing as extern_directory, you can look at unigine src =)

 

Every of folder contains 'data'. Like

../data/
../../extern/data/
../../common/data/
../../groups/data/

And by using unigine resource system we expect that this 'data' merge in one virtual-fs and and it happens, but with bugs that I mentioned.

Link to comment

Hi Vlad!

 

There should be no problems with using File/Xml class with virtual fs in the script as it's trying to get the file from virtual fs first. The only trouble is with Dir class, because it's based on OS API calls and doesn't know anything about virtual fs.

 

If you have troubles with File/Xml class then please send us a minimal reproduction sample. Thanks!

Link to comment

Hi =)

 

I understood you, we tested again File and we have no problems with it, as well as with XML.

 

What we need to do is bypass directory and collect all XMLs. Something like this:

Dir directory = new Dir(path);

forloop(int i=0; directory.getNumFiles())
{
    string filename = basename(directory.getFileName(i));

    models.append(filename);
}

And we want use vfs to do that.

Link to comment

Vlad,

 

There's no easy way you can traverse specific dir in virtual fs. However, you can traverse through the list of filenames which you can get via Filesystem::getFileNames call.

Link to comment

Andrey, can we request this feature for future releases? =) It's very useful when you can access vfs transparently, like, for example, in ogre3d engine or some mmo engines (wow, gw2).

 

Thx!

Link to comment
×
×
  • Create New...