Commit c66f1d56 authored by Eric Duminil's avatar Eric Duminil
Browse files

Allow Repo to be a project.

parent 50c68ebb
Pipeline #7233 passed with stage
in 32 seconds
......@@ -110,7 +110,6 @@ public Integer call() throws IOException, XPathParseException, NavException, Par
public void selectRepository() {
//FIXME: Allow project folders too. But don't silently fail if repo isn't really a repo
Preferences userPrefs = Preferences.userRoot().node("/eu/simstadt/desktop");
DirectoryChooser fileChooser = new DirectoryChooser();
......@@ -135,7 +134,7 @@ private File selectSaveFileWithDialog(String project, String citygml, String suf
Stage mainStage = (Stage) RegionChooserBrowser.this.getScene().getWindow();
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Save CITYGML ids");
if (project != null) {
if (project != null && !isRepoAProject()) {
fileChooser.setInitialDirectory(repo.resolve(project + ".proj").toFile());
} else {
fileChooser.setInitialDirectory(repo.toFile());
......@@ -158,8 +157,21 @@ public void warning(String text) {
LOGGER.warning(text);
}
/*
* NOTE: Users sometime select some_region.proj/ as a repository.
* SimStadt won't show any project in this "repository", but RegionChooser shouldn't complain and
* still be able to extract regions.
*/
private boolean isRepoAProject(){
return repo.toString().endsWith(".proj");
}
private Path citygmlPath(String project, String citygml) {
return repo.resolve(project + ".proj").resolve(citygml);
if (isRepoAProject()){
return repo.resolve(citygml);
} else {
return repo.resolve(project + ".proj").resolve(citygml);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment