public void saveProgram(Program program, List<String> path) throws Exception {
		if (program == null) {
			return;
		}
		if (program.getDomainFile().isInWritableProject()) {
			if (program == currentProgram) {
				end(true);
			}
			try {
				program.save(getClass().getName(), monitor);
			}
			finally {
				if (program == currentProgram) {
					start();
				}
			}
			return;
		}
		DomainFolder folder = getProjectRootFolder();
		if (path != null) {
			for (String folderName : path) {
				if (folderName == null || folderName.isEmpty()) {
					continue;
				}
				DomainFolder existingFolder = folder.getFolder(folderName);
				if (existingFolder == null) {
					folder = folder.createFolder(folderName);
				}
				else {
					folder = existingFolder;
				}
			}
		}
		if (program == currentProgram) {
			end(true);//end the current open transaction, so that we can save...
		}
		try {
			folder.createFile(program.getName(), program, monitor);
		}
		catch (DuplicateFileException e) {
			SimpleDateFormat formatter = new SimpleDateFormat("dd.MMM.yyyy_HH.mm.ss");
			String time = formatter.format(new Date());
			folder.createFile(program.getName() + "_" + time, program, monitor);
		}
		finally {
			if (program == currentProgram) {
				start();//start a new transaction, now that save is done...
			}
		}
		monitor.setCancelEnabled(true);
		folder.setActive();//makes the data tree expand to show new file!
	}
Saves changes to the specified program.
<p>
If the program does not already exist in the current project
then it will be saved into a project folder path specified by the path parameter.
<p>
If path is NULL, the program will be saved into the root folder.  If parts of the path are
missing, they will be created if possible.
<p>
If a program already exists with the specified name, then a time stamp will be appended
to the name to make it unique.

@param program the program to save
@param path list of string path elements (starting at the root of the project) that specify
the project folder to save the program info.  Example: { "folder1", "subfolder2",
"final_folder" }
@throws Exception if there is any exception
Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java