diff --git a/gui/src/main/groovy/com/muwire/gui/wizard/DirectoriesStep.groovy b/gui/src/main/groovy/com/muwire/gui/wizard/DirectoriesStep.groovy index 53de38fc..6c56ec9b 100644 --- a/gui/src/main/groovy/com/muwire/gui/wizard/DirectoriesStep.groovy +++ b/gui/src/main/groovy/com/muwire/gui/wizard/DirectoriesStep.groovy @@ -36,14 +36,28 @@ class DirectoriesStep extends WizardStep { @Override protected List validate() { - // TODO Auto-generated method stub - return null + def rv = [] + if (!canWrite(downloadLocationField.text)) + rv << "Download location not writeable" + if (!canWrite(incompleteLocationField.text)) + rv << "Incomplete location not writeable" + rv + } + + private static boolean canWrite(String location) { + File f = new File(location) + if (f.exists()) + return f.isDirectory() && f.canWrite() + canWrite(f.getParentFile().getAbsolutePath()) } @Override protected void apply(MuWireSettings muSettings, Properties i2pSettings) { - // TODO Auto-generated method stub - + muSettings.downloadLocation = new File(downloadLocationField.text) + muSettings.incompleteLocation = new File(incompleteLocationField.text) + + muSettings.downloadLocation.mkdirs() + muSettings.incompleteLocation.mkdirs() } def showDownloadChooser = {