Skip to content

Commit

Permalink
getting autosave file
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraux committed Mar 3, 2020
1 parent aac8bee commit d882421
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions de/jstacs/fx/repository/ResultRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import de.jstacs.fx.Application;
import de.jstacs.fx.renderers.parameters.FileParameterRenderer;
import de.jstacs.io.FileManager;
Expand Down Expand Up @@ -65,6 +67,7 @@ public static interface ResultConsumer{
* Global property for an {@link Application} run, if the workspace is automatically saved to disk.
*/
public static BooleanProperty autosave = new SimpleBooleanProperty( false );
public static StringProperty autodir = new SimpleStringProperty(null);
private static ResultRepository instance;

private LinkedList<Result> results;
Expand All @@ -85,7 +88,7 @@ private ResultRepository(){
this.results = new LinkedList<>();
this.consumers = new ArrayList<>();
if(autosave.get()){
File f = new File("autosave.jst");
File f = new File(autodir.get());
if(f.exists()){
try{
StringBuffer sb = FileManager.readFile( f );
Expand Down Expand Up @@ -152,7 +155,7 @@ public boolean autostore(){
@Override
public void run() {
try{
FileManager.writeFile( "autosave.jst", Compression.zip( storeResultsToXML().toString() ) );
FileManager.writeFile( autodir.get(), Compression.zip( storeResultsToXML().toString() ) );
}catch(IOException e){
e.printStackTrace();
}
Expand Down

0 comments on commit d882421

Please sign in to comment.