How to use filesystem boost copy_file with qrc resources?

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

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini » 17 Oct 2013, 19:21

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: 2121
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka » 17 Oct 2013, 19:50

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: 5134
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini » 17 Oct 2013, 20:34

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: 2121
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka » 18 Oct 2013, 07:47

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: 5134
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini » 18 Oct 2013, 09:22

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: 2121
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka » 18 Oct 2013, 09:28

At least we have a command arguments handling now. That's something, right? ;-)

User avatar
sirherrbatka
Posts: 2121
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka » 18 Oct 2013, 17:18

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: 5134
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini » 18 Oct 2013, 17:32

Yes.

User avatar
sirherrbatka
Posts: 2121
Joined: 07 Aug 2011, 17:21

Re: How to use filesystem boost copy_file with qrc resources

Post by sirherrbatka » 19 Oct 2013, 15:01

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: 5134
Joined: 06 Aug 2011, 15:16

Re: How to use filesystem boost copy_file with qrc resources

Post by Zini » 19 Oct 2013, 15:19

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

Who is online

Users browsing this forum: No registered users and 1 guest