Invert if condition in ContentSettingsFragment.setImportExportDataPath for better readability

This commit is contained in:
Alireza Tofighi 2021-05-21 20:24:57 +04:30
parent fa2b11b768
commit 92ab9cae27

View file

@ -257,15 +257,15 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
private void setImportExportDataPath(final File file) {
final String directoryPath;
if (!file.isDirectory()) {
if (file.isDirectory()) {
directoryPath = file.getAbsolutePath();
} else {
final File parentFile = file.getParentFile();
if (parentFile != null) {
directoryPath = parentFile.getAbsolutePath();
} else {
directoryPath = "";
}
} else {
directoryPath = file.getAbsolutePath();
}
defaultPreferences.edit().putString(importExportDataPathKey, directoryPath).apply();
}