Error handle filetree generation
This commit is contained in:
parent
581bb0ad3b
commit
505f6872f2
@ -20,6 +20,7 @@ import app.events.OpenFileEvent;
|
|||||||
import app.events.OpenProjectEvent;
|
import app.events.OpenProjectEvent;
|
||||||
import app.events.SaveFileEvent;
|
import app.events.SaveFileEvent;
|
||||||
import app.model.Model;
|
import app.model.Model;
|
||||||
|
import app.service.DialogBoxes;
|
||||||
import app.service.FiletreeOperations;
|
import app.service.FiletreeOperations;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
|
||||||
@ -56,9 +57,17 @@ public class FiletreeController implements Initializable, Controller {
|
|||||||
filetree.setShowRoot(false);
|
filetree.setShowRoot(false);
|
||||||
File fileInputChosen = new File(inputChosen);
|
File fileInputChosen = new File(inputChosen);
|
||||||
|
|
||||||
FiletreeOperations.generateTree(fileInputChosen, root);
|
try {
|
||||||
|
FiletreeOperations.generateTree(fileInputChosen, root);
|
||||||
|
|
||||||
filetree.setRoot(root);
|
filetree.setRoot(root);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Model.setProjectPath(Optional.empty());
|
||||||
|
DialogBoxes.showErrorMessage(
|
||||||
|
"Could not open folder.\n\n"
|
||||||
|
+ "Do you have the right permissions for this folder?\n"
|
||||||
|
+ "Or does the folder contain any shortcut to somewhere within itself?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
@ -51,8 +51,7 @@ public class FileOperations {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
DialogBoxes.showErrorMessage("Could not save file!");
|
DialogBoxes.showErrorMessage("Could not save file at \n" + filepath.toString());
|
||||||
System.err.println(filepath);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user