Discrepancy between OSes when loading data= lines

Everything about development and the OpenMW source code.
Post Reply
User avatar
AnyOldName3
Posts: 619
Joined: 26 Nov 2015, 03:25

Discrepancy between OSes when loading data= lines

Post by AnyOldName3 » 07 Dec 2016, 19:26

I'm finally making a dedicated thread for this, as my investigations aren't turning anything up.

Even though the data="path/to/mod/or/main/data/folder" lines in the config files are supposed to require quotation marks around the path, some users have reported that the opposite behaviour occurs for them - they only work when the quote marks are not present.

This has mostly been discussed in two threads: The two users with this issue are:
  • SteveOdom using Linux Mint 18 (Sarah) 64-bit and 17 32-bit, with builds from the Ubuntu PPA.
  • Erasmus using OSX El Capitan 10.11.5, using builds from GitHub
However, I've so far failed to reproduce this issue at all. (I thought I had, but cannot find a single linux install or VM which I have that exhibits the issue, suggesting that I'm misremembering).

I've made a minimal example of what I think is broken, which should compile on any machine with boost, so if anyone reporting the issue (or who thinks they could potentially be a victim) could please build and run it, then post the output, that might well help debug this a lot faster.

Note: If anyone thinks they've got this issue, it's likely you won't be able to do anything with OpenMW, as the launcher and wizard both add the quotes, so OpenMW won't even be able to see your main data directory. If you've successfully downloaded, installed, run the launcher and wizard for, and then the main engine of OpenMW, all without having to tweak the config files manually, then it's pretty much certain that this doesn't affect you.

The test stuff:

BoostPathTest.cpp

Code: Select all

#include <iostream>

#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>

void readConfiguration(boost::program_options::variables_map & variables, boost::program_options::options_description & description)
{
	boost::filesystem::path cfgFile("config.cfg");

	if (boost::filesystem::is_regular_file(cfgFile))
	{
		boost::filesystem::ifstream cfgStream(cfgFile);
		if (cfgStream.is_open())
		{
			boost::program_options::store(boost::program_options::parse_config_file(cfgStream, description, true), variables);
		}
	}
}

int main()
{
	namespace bpo = boost::program_options;

	bpo::options_description desc("This is a string what I writ");
	desc.add_options()("filepath", bpo::value<std::vector<boost::filesystem::path>>()->default_value(std::vector<boost::filesystem::path>(), "astring")->multitoken()->composing(), "A third string");
	
	bpo::variables_map variables;

	readConfiguration(variables, desc);

	std::vector<boost::filesystem::path> paths(variables["filepath"].as<std::vector<boost::filesystem::path>>());

	for (boost::filesystem::path path : paths)
	{
		std::cout << path << ", " << path.string() << std::endl;
	}

	return 0;
}
config.cfg for test 1

Code: Select all

filepath="this is a / string / what/i/wrote/"
filepath="C:\Program Files\Thing Simulator\res\"
filepath="~/wibble/wobble"
config.cfg for test 2

Code: Select all

filepath=this is a / string / what/i/wrote/
filepath=C:\Program Files\Thing Simulator\res\
filepath=~/wibble/wobble
EDIT: In g++ I had to use -std=c++11 or greater to make this compile because of the shorthand for loop

EDIT 2: I realised I'd missed out the second test.
AnyOldName3, Master of Shadows

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest