How to use filesystem boost copy_file with qrc resources?

Involved development of the OpenMW construction set.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini »

While we are at it, may I ask for one more enhancement?

When loading the global resources file, first look in the user directory and if the file exists there, use that one instead. This will allow more advanced users to customise the filters for new projects.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka »

Already implemented.
Really? I didn't found any switch handling in OpenCS code. Using opencs --help also showed nothing. Either I missunderstood you or I broke something… really bad.
When loading the global resources file, first look in the user directory and if the file exists there, use that one instead. This will allow more advanced users to customise the filters for new projects.
Sounds like a good idea.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini »

Really? I didn't found any switch handling in OpenCS code. Using opencs --help also showed nothing. Either I missunderstood you or I broke something… really bad.
Right. There are still bits and pieces missing. Currently the switches are pulled only from the openmw.cfg files. Command line input is not implemented yet. But it doesn't really matter for the time being.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka »

This is so stupid that I don't know where to begin.

When you asked about switch, I was sure you refer to the command line switch. So I implemented it. :oops:
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini »

I guess I could have been clearer about that, but I was actually not aware that this part was still missing until I looked at it following one of your postings. OpenCS is still a bit piecemeal.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka »

At least we have a command arguments handling now. That's something, right? ;-)
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka »

Or not. I think I made this wrong.

Currently arguments go from main to the editor.run. Editor.run feeds arguments to the parser.

I think this should be rather done inside constructor. Am I right?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini »

Yes.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka »

Almost done. But I have problem with checking if defaultfilters are present inside data dirs. Right now I'm doing it like this:

Code: Select all

//     Adding Resources directory. First check if there is a file defaultfilters in the data files
    bool locDefaultFiltersPresent(false);
    for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
    {
        boost::filesystem::path path(iter->string());
        path /= "defaultfilters.omwaddon.project";
        if (boost::filesystem::exists(path) )
        {
            mDocumentManager.setResourceDir(iter->string());
            locDefaultFiltersPresent = true;
            break;
        }
    }

    if (!locDefaultFiltersPresent)
    {
        mDocumentManager.setResourceDir(variables["resources"].as<std::string>());
    }
But locDefaultFiltersPresent is always false, even if i have ${HOME}/.config/openmw/projects/defaultfilters.omwaddon.project file right there. Do I miss something?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini »

That is the wrong location. You are checking the data directories. You should check the user directory instead.

Edit: Also, I suggest to rename the file to defaultfilters. The .omwaddon.project part doesn't make any sense. And you should also not use a projects sub-directory, because this is for individual projects, while the defaultfitlers are a global file.
Post Reply