Emulationstation from batocera with configs and scripts for integration as Arch-Linux package
This project is maintained by GB609
There are several config files (and types) throughout the system that btc-config needs to generate or maintain.
Additionally, there are situations where a list of properties has to be printed, optionally in different formats.
All of this is encapulated in this module. It supports several output formats and is fully transparent about the
target to write to. In addition, the all a user has to know is the format name, the outside API is identical for
all of the writers.
Currently supported:
To use a writer, use requiredModule[formatName].write(dictionary, fileOrStream, options).
Implementation details:
{Writer} which sets up the generic API.
The generic API mostly consists of a static method write and an instance method write.writeDict.write, neither static nor instance-specific. This is core writer api.Writer.write() is a static method that works as a writer instance factory. It detects the class type
it was invoked from and creates a new instance of that. Then passes the data and options to writeDict
after setting up the output channel.this.write(string|string[]) to generate output.Assign given default to property with the given name if it is not defined. Includes special treatment for PropValue instances
This class is the core API and generic part of all writer implementations.
Every new writer MUST extends this and follow the contract specified above.
The constructor sets up the output. Subclassed must not provide a contructor.
This method is the main entry to the writer API and must not be redeclared on any subclass.
It will handle the full logic flow needed to write to any output:
writerInstance.writeDict()About options
options are a way to control the behaviour of writers. It is a simple dictionary.
Most options are writer-specific. The generic entry method supports 2 options at the moment:
options.verbose=boolean: Add a log statement when the actual writing using writeDict begins.options.createRootKeysDictFile=/path/to/file:
This generates a ‘summary’ file at the specified location which contains only the root keys of dict.Some options are supported by multiple writers:
options.printSource=boolean:
For debugging when dict is a merge result which should be written in a format supporting comments.
Every property value written will be accompanied by a comment stating which file it came from.options.comment=string: Adds the given text as comment to the head of the file if supported.Simple wrapper of the writer API that does not produce output in a predefined format.
It just outputs the string value of whatever is passed in. No support for any further options,
aside from those handled by the generic {Writer}. But these do not make much sense to use here.
Writes the given dict as batocera-style .conf file, like batocera.conf.
dict structures will be flattened firstSupported options:
options.comment=string: no comment when not givenoptions.printSource=boolean: default falseWrites data to a json file.
Write object graphs to as structured XML, based on the definitions from xmlToDict.
Emulationstation uses XML for some config files. Most of them have the file ending *.cfg.
And they have in common that they don’t share any tags or structure, they are specific, well known and named files,
serving different purposes. There exist dedicated writes for most of them because they are so different.
Supported options:
options.comment=string: no comment when not givenThis writer implementation is meant to specifically generate the file es_settings.cfg.
EmulationStation uses several *.cfg files, but they don’t share a common structure in terms of properties.
The only th
Generated with shdoc from /opt/batocera-emulationstation/node_modules/io/writers.js