Create dedicated directories on the user set cache dir (who is supose to be already dedicated...)

This commit is contained in:
Laurent Clouet
2018-08-18 02:03:51 +02:00
parent e5f837a249
commit 9a63ea06ed
2 changed files with 17 additions and 5 deletions

View File

@@ -213,8 +213,10 @@ public class Configuration {
}
else {
this.userHasSpecifiedACacheDir = true;
this.workingDirectory = cache_dir_;
this.storageDirectory = cache_dir_;
this.workingDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + "sheepit");
this.storageDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + "sheepit_binary_cache");
this.workingDirectory.mkdir();
this.storageDirectory.mkdir();
}
}
@@ -241,6 +243,16 @@ public class Configuration {
return this.userHasSpecifiedACacheDir;
}
public File getCacheDirForSettings() {
if (this.getUserHasSpecifiedACacheDir() == false) {
return null;
}
else {
// when the user have a cache directory a "sheepit" and "sheepit_binary_cache" is be automaticaly added
return this.workingDirectory.getParentFile();
}
}
public void setExtras(String str) {
this.extras = str;
}