Merge branch 'Conf-misc-fixes' into 'master'

Rework getdir functions

See merge request sheepitrenderfarm/client!262
This commit is contained in:
harlekin
2023-11-22 17:10:16 +00:00

View File

@@ -212,38 +212,20 @@ import lombok.Data;
} }
} }
public void setStorageDir(File dir) {
if (dir != null) {
if (dir.exists() == false) {
dir.mkdir();
}
this.storageDirectory = dir;
}
}
/** /**
* @return the storage directory or the working directory if the former is not defined * @return the storage directory or the working directory if the former is not defined
*/ */
public File getStorageDir() { public File getStorageDir() {
if (this.storageDirectory == null) { return this.storageDirectory == null ? this.workingDirectory : this.storageDirectory;
return this.workingDirectory;
}
else {
return this.storageDirectory;
}
} }
/** /**
* @return the user specified cache directory or null if it hasn't been specified * @return the user specified cache directory or null if it hasn't been specified
*/ */
public File getCacheDirForSettings() { public File getCacheDirForSettings() {
if (this.userHasSpecifiedACacheDir == false) { // when the user has a cache directory specified,
return null; // a "sheepit" and "sheepit_binary_cache" directory is to be automatically created
} return this.userHasSpecifiedACacheDir == false ? null : this.workingDirectory.getParentFile();
else {
// when the user have a cache directory a "sheepit" and "sheepit_binary_cache" is be automaticaly added
return this.workingDirectory.getParentFile();
}
} }
/** /**