private boolean isValid(String dir, String projectName) {
		if (dir.isBlank()) {
			setStatusMessage("Please specify project directory");
			return false;
		}
		File projectDir = new File(dir);
		if (!projectDir.isDirectory()) {
			setStatusMessage("Project directory does not exist.");
			return false;
		}

		if (!NamingUtilities.isValidProjectName(projectName)) {
			setStatusMessage("Please specify valid project name");
			return false;
		}
		try {
			ProjectLocator locator = new ProjectLocator(dir, projectName);
			if (locator.getMarkerFile().exists() || locator.getProjectDir().exists()) {
				setStatusMessage("A project named " + locator.getName() +
					" already exists in " + projectDir.getAbsolutePath());
				return false;
			}
		}
		catch (IllegalArgumentException e) {
			setStatusMessage(e.getMessage());
			return false;
		}
		return true;
	}
Wizard step in the new project wizard for choosing the new project's root folder location and
naming the project.
Ghidra/Framework/Project/src/main/java/ghidra/framework/main/wizard/project/SelectProjectStep.java