public static void launchLocalDonkey(String daemonDir,
DonkeyTalker talker) throws IOException {
new File(daemonDir + "/searches.ini.tmp").delete();
File dir = new File(daemonDir);
Util.launchShell("\"" + daemonDir + "/mldonkey\" < /dev/null >/tmp/mldonkey.console &", dir);
//Process p = Runtime.getRuntime().exec(new String[]{daemonDir + "/mldonkey"},
// new String[]{}, dir);
for(int i=0; i< 10; i++) {
try {
talker.connect(10000);
return;
}
catch(IOException e) {
try {
Thread.sleep(1000);
}
catch(InterruptedException e2) {
}
}
}
throw new IOException("Cannot connect");
}
|