mirror of https://github.com/zlatinb/muwire
add options for portable installation, issue #2
parent
ba596af778
commit
5138935c20
|
@ -28,7 +28,11 @@ class Ready extends AbstractLifecycleHandler {
|
||||||
@Override
|
@Override
|
||||||
void execute() {
|
void execute() {
|
||||||
log.info "starting core services"
|
log.info "starting core services"
|
||||||
def home = System.getProperty("user.home") + File.separator + ".MuWire"
|
def portableHome = System.getProperty("portable.home")
|
||||||
|
def home = portableHome == null ?
|
||||||
|
System.getProperty("user.home") + File.separator + ".MuWire" :
|
||||||
|
portableHome
|
||||||
|
|
||||||
home = new File(home)
|
home = new File(home)
|
||||||
if (!home.exists()) {
|
if (!home.exists()) {
|
||||||
log.info("creating home dir")
|
log.info("creating home dir")
|
||||||
|
@ -64,8 +68,13 @@ class Ready extends AbstractLifecycleHandler {
|
||||||
nickname = nickname.trim()
|
nickname = nickname.trim()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
props.setNickname(nickname)
|
||||||
|
|
||||||
while(true) {
|
|
||||||
|
def portableDownloads = System.getProperty("portable.downloads")
|
||||||
|
if (portableDownloads != null) {
|
||||||
|
props.downloadLocation = new File(portableDownloads)
|
||||||
|
} else {
|
||||||
def chooser = new JFileChooser()
|
def chooser = new JFileChooser()
|
||||||
chooser.setDialogTitle("Select a directory where downloads will be saved")
|
chooser.setDialogTitle("Select a directory where downloads will be saved")
|
||||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
|
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
|
||||||
|
@ -75,9 +84,8 @@ class Ready extends AbstractLifecycleHandler {
|
||||||
System.exit(0)
|
System.exit(0)
|
||||||
}
|
}
|
||||||
props.downloadLocation = chooser.getSelectedFile()
|
props.downloadLocation = chooser.getSelectedFile()
|
||||||
break
|
|
||||||
}
|
}
|
||||||
props.setNickname(nickname)
|
|
||||||
propsFile.withOutputStream {
|
propsFile.withOutputStream {
|
||||||
props.write(it)
|
props.write(it)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue