diff --git a/src/main/java/bigwarp/BigWarp.java b/src/main/java/bigwarp/BigWarp.java index e952f41..ba00b5b 100755 --- a/src/main/java/bigwarp/BigWarp.java +++ b/src/main/java/bigwarp/BigWarp.java @@ -4012,10 +4012,17 @@ protected void saveLandmarks() protected void saveLandmarks( final String filename ) throws IOException { - if( filename.endsWith("csv")) - landmarkModel.save(new File( filename )); - else if( filename.endsWith("json")) - TransformWriterJson.write(landmarkModel, bwTransform, new File( filename )); + final File f = new File( filename ); + if( filename.endsWith("csv")) { + landmarkModel.save( f ); + setLastDirectory(f.getParentFile()); + } + else if( filename.endsWith("json")) { + TransformWriterJson.write(landmarkModel, bwTransform, f); + setLastDirectory(f.getParentFile()); + } + + // TODO message to users if neither case succeeds } protected void loadLandmarks() @@ -4051,7 +4058,6 @@ public void loadLandmarks( final String filename ) catch ( URISyntaxException e ) { } final File file = new File( name ); - setLastDirectory( file.getParentFile() ); if( name.endsWith( "csv" )) { try @@ -4068,6 +4074,8 @@ else if( name.endsWith( "json" )) TransformWriterJson.read( file, this ); } + setLastDirectory( file.getParentFile() ); + final boolean didCompute = restimateTransformation(); // didCompute = false means that there were not enough points @@ -4109,13 +4117,11 @@ protected void saveSettingsOrProject( final File proposedFile ) { final String canonicalPath = settingsFile.getCanonicalPath(); if ( canonicalPath.endsWith( ".xml" ) ) - { - saveSettings( canonicalPath ); - } + saveSettings(canonicalPath); else - { - saveSettingsJson( canonicalPath ); - } + saveSettingsJson(canonicalPath); + + setLastDirectory(settingsFile.getParentFile()); } catch ( final IOException e ) { @@ -4343,6 +4349,8 @@ public void loadSettings( final String jsonOrXmlFilename, boolean overwriteSourc activeSourcesDialogQ.update(); } + setLastDirectory(new File(jsonOrXmlFilename).getParentFile()); + viewerFrameP.repaint(); viewerFrameQ.repaint(); }