|
Add new CppResource pseudo-builder that would allow for addition of arbitrary source files to the output cpp binary and support listing/retrieving contents of those files during execution.
Proposed usage:
SConscript file:
|
env.CppResource(
|
target='my_resources.cpp',
|
exportname='mongo::my_namespace::MyResources',
|
source=[
|
'A.txt',
|
'B.png',
|
],
|
)
|
|
Cpp source code:
|
#include "mongo/util/static_resources.h"
|
extern const StaticResources mongo::my_namespace::MyResources;
|
... // Get all the resources:
|
const std::map<string, StringData>& resourceMap = mongo::my_namespace::MyResources.items(); // Get the contents of a specific resource.
|
std::cout << "Resource contents:" << mongo::my_namespace::MyResources.getResourceByName("src/mongo/my_project_path/A.txt")->toString() << std::endl;
|
|