Sometimes it's useful to set the project name in a .jucer file from the command line. For example as part of an automated build on a CI server.
At the moment, I do this using the following Python function (I also set the version - I didn't know I could use --set-version!):
def set_jucer_version(jucer_file, version, name): if not os.path.isfile(jucer_file): print("Jucer file not found at: " + jucer_file) sys.exit(1) try: tree = ElementTree.parse(jucer_file) project = tree.getroot() project.set('version', version) project.set('name', name) main_group = project.find('MAINGROUP') main_group.set('name', name) export_formats = project.find('EXPORTFORMATS') for export_format in export_formats.findall('*'): configurations = export_format.find('CONFIGURATIONS') for configuration in configurations.findall('*'): configuration.set('targetName', name) tree.write(jucer_file) except AttributeError: print("Error parsing jucer file: " + jucer_file) sys.exit(1) print("Set version " + version + " and name " + name + " in .jucer file " + jucer_file) pass
This is a bit hacky as it's relying on the format of the jucer file remaining fixed, so it would be nice if it was built into the Introjucer.
Enjoy the low hanging fruit!