Fix: store the .zip and .wool on the same directory
This commit is contained in:
@@ -44,6 +44,8 @@ import lombok.Data;
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Data public class Configuration {
|
||||
public static final String WORKING_DIRNAME = "sheepit";
|
||||
public static final String WOOL_CACHE_DIRNAME = "sheepit_wool_cache";
|
||||
|
||||
public static final String jarVersion = getJarVersion();
|
||||
|
||||
@@ -55,9 +57,8 @@ import lombok.Data;
|
||||
private String logDirectory;
|
||||
private File workingDirectory;
|
||||
private File sharedDownloadsDirectory;
|
||||
private File storageDirectory; // for permanent storage (binary archive)
|
||||
private File woolCacheDirectory; // store all the chunks (and binary for now)
|
||||
private boolean userHasSpecifiedACacheDir;
|
||||
private String static_exeDirName;
|
||||
private String login;
|
||||
private String password;
|
||||
private String proxy;
|
||||
@@ -91,7 +92,6 @@ import lombok.Data;
|
||||
this.password = password_;
|
||||
this.proxy = null;
|
||||
this.hostname = this.getDefaultHostname();
|
||||
this.static_exeDirName = "exe";
|
||||
this.maxUploadingJob = 1;
|
||||
this.nbCores = -1; // ie not set
|
||||
this.maxAllowedMemory = -1; // ie not set
|
||||
@@ -103,7 +103,7 @@ import lombok.Data;
|
||||
this.detectGPUs = true;
|
||||
this.workingDirectory = null;
|
||||
this.sharedDownloadsDirectory = null;
|
||||
this.storageDirectory = null;
|
||||
this.woolCacheDirectory = null;
|
||||
this.setCacheDir(cache_dir_);
|
||||
this.printLog = false;
|
||||
this.debugLevel = false;
|
||||
@@ -132,9 +132,8 @@ import lombok.Data;
|
||||
c + "logDir: " + (logDirectory == null ? "NULL" : logDirectory) + n +
|
||||
c + "workingDirectory: " + workingDirectory + n +
|
||||
c + "sharedDownloadsDirectory: " + sharedDownloadsDirectory + n +
|
||||
c + "storageDirectory: " + storageDirectory + n +
|
||||
c + "woolCacheDirectory: " + woolCacheDirectory + n +
|
||||
c + "userHasSpecifiedACacheDir: " + userHasSpecifiedACacheDir + n +
|
||||
c + "static_exeDirName: " + static_exeDirName + n +
|
||||
c + "login: " + login + n +
|
||||
c + "proxy: " + proxy + n +
|
||||
c + "maxUploadingJob: " + maxUploadingJob + n +
|
||||
@@ -201,8 +200,8 @@ import lombok.Data;
|
||||
// since there is no working directory and the client will be working in the system temp directory,
|
||||
// we can also set up a 'permanent' directory for immutable files (like renderer binary)
|
||||
|
||||
this.storageDirectory = new File(this.workingDirectory.getParent() + File.separator + "sheepit_binary_cache");
|
||||
this.storageDirectory.mkdir();
|
||||
this.woolCacheDirectory = new File(this.workingDirectory.getParent() + File.separator + WOOL_CACHE_DIRNAME);
|
||||
this.woolCacheDirectory.mkdir();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -210,10 +209,10 @@ import lombok.Data;
|
||||
}
|
||||
else {
|
||||
this.userHasSpecifiedACacheDir = true;
|
||||
this.workingDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + "sheepit");
|
||||
this.storageDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + "sheepit_binary_cache");
|
||||
this.workingDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + WORKING_DIRNAME);
|
||||
this.woolCacheDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + WOOL_CACHE_DIRNAME);
|
||||
this.workingDirectory.mkdirs();
|
||||
this.storageDirectory.mkdirs();
|
||||
this.woolCacheDirectory.mkdirs();
|
||||
}
|
||||
|
||||
if (this.sharedDownloadsDirectory != null) {
|
||||
@@ -225,19 +224,12 @@ import lombok.Data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the storage directory or the working directory if the former is not defined
|
||||
*/
|
||||
public File getStorageDir() {
|
||||
return this.storageDirectory == null ? this.workingDirectory : this.storageDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the user specified cache directory or null if it hasn't been specified
|
||||
*/
|
||||
public File getCacheDirForSettings() {
|
||||
// when the user has a cache directory specified,
|
||||
// a "sheepit" and "sheepit_binary_cache" directory is to be automatically created
|
||||
// a "sheepit" and "wool_cache" directory is to be automatically created
|
||||
return this.userHasSpecifiedACacheDir == false ? null : this.workingDirectory.getParentFile();
|
||||
}
|
||||
|
||||
@@ -258,7 +250,7 @@ import lombok.Data;
|
||||
*/
|
||||
public void cleanWorkingDirectory() {
|
||||
this.cleanDirectory(this.workingDirectory);
|
||||
this.cleanDirectory(this.storageDirectory);
|
||||
this.cleanDirectory(this.woolCacheDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,8 +321,8 @@ import lombok.Data;
|
||||
files.addAll(Arrays.asList(filesInDirectory));
|
||||
}
|
||||
}
|
||||
if (this.storageDirectory != null) {
|
||||
File[] filesInDirectory = this.storageDirectory.listFiles();
|
||||
if (this.woolCacheDirectory != null) {
|
||||
File[] filesInDirectory = this.woolCacheDirectory.listFiles();
|
||||
if (filesInDirectory != null) {
|
||||
files.addAll(Arrays.asList(filesInDirectory));
|
||||
}
|
||||
@@ -379,8 +371,8 @@ import lombok.Data;
|
||||
if (sharedDownloadsDirectory != null && dirsToCheck.contains(sharedDownloadsDirectory.getAbsoluteFile()) == false) {
|
||||
dirsToCheck.add(sharedDownloadsDirectory.getAbsoluteFile());
|
||||
}
|
||||
if (storageDirectory != null && dirsToCheck.contains(storageDirectory.getAbsoluteFile()) == false) {
|
||||
dirsToCheck.add(storageDirectory.getAbsoluteFile());
|
||||
if (woolCacheDirectory != null && dirsToCheck.contains(woolCacheDirectory.getAbsoluteFile()) == false) {
|
||||
dirsToCheck.add(woolCacheDirectory.getAbsoluteFile());
|
||||
}
|
||||
ListIterator<File> dirs = dirsToCheck.listIterator();
|
||||
while (dirs.hasNext()) {
|
||||
|
||||
Reference in New Issue
Block a user