private File getSaveFile() {

		GhidraFileChooser fileChooser = new GhidraFileChooser(rootPanel);
		fileChooser.setTitle("Choose Save Archive File");
		fileChooser.setApproveButtonText("Choose Save Archive File");
		fileChooser.setApproveButtonToolTipText("Choose filename for archive");
		fileChooser.setLastDirectoryPreference(Preferences.LAST_EXPORT_DIRECTORY);

		File file = fileChooser.getSelectedFile();
		fileChooser.dispose();
		if (file == null) {
			return null;
		}

		File parent = file.getParentFile();
		if (parent != null) {
			Preferences.setProperty(Preferences.LAST_EXPORT_DIRECTORY,
				parent.getAbsolutePath());
		}

		String name = file.getName();
		if (!file.getName().endsWith(FileDataTypeManager.SUFFIX)) {
			file = new File(file.getParentFile(), name + FileDataTypeManager.SUFFIX);
		}

		if (!file.exists()) {
			return file;
		}

		int choice = OptionDialog.showOptionDialog(rootPanel, "Overwrite Existing File?",
			"The file " + file.getAbsolutePath() +
				" already exists.\nDo you want to overwrite it?",
			"Yes", OptionDialog.QUESTION_MESSAGE);

		if (choice != OptionDialog.OPTION_ONE) {
			return null;
		}

		try {
			PackedDatabase.delete(file);
		}
		catch (IOException e) {
			Msg.showError(this, mainPanel, "Archive Overwrite Failed", e.getMessage());
			return null;
		}
		return file;
	}
Dialog that shows files used for parsing C header files. The profile has a list of source header
files to parse, followed by parse options (compiler directives). Ghidra supplies a Windows
profile by default in core/parserprofiles. The user can do "save as" on this default profile to
create new profiles that will be written to the user's {@code <home>/userprofiles} directory. The
CParserPlugin creates this directory if it doesn't exist.
<p>
The data types resulting from the parse operation can either be added to the data type manager in
the current program, or written to an archive data file.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/cparser/ParseDialog.java