Access project title and version from C++


Is it possible to access the project title and version (set in the project.json file) from code?


Unfortunately not, we don’t have a utility function for that. The project.json file is only used by our build system to set up the project and figure out dependencies. You can however load the .json file manually:

		std::string buffer;
		utility::readFileToString(path, buffer, errorState);
		rapidjson::Document document;
		rapidjson::ParseResult parse_result = document.Parse(buffer.c_str());

And extract info from there.



In NAP 0.4.0 we introduced the nap::ProjectInfo resource, declared in the project.json file. The resource contains links to the main data, config and path mapping files. On initialization core loads the config.json and uses that information to resolve all paths internally, which is new and now completely data driven. This allows for more flexibility in the future when you want to, for example, link to a NAP package from an application that is stored external from it.

As a consequence, you now have access to all that information from core: