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) { private void setImportExportDataPath(final File file) {
final String directoryPath; final String directoryPath;
if (!file.isDirectory()) { if (file.isDirectory()) {
directoryPath = file.getAbsolutePath();
} else {
final File parentFile = file.getParentFile(); final File parentFile = file.getParentFile();
if (parentFile != null) { if (parentFile != null) {
directoryPath = parentFile.getAbsolutePath(); directoryPath = parentFile.getAbsolutePath();
} else { } else {
directoryPath = ""; directoryPath = "";
} }
} else {
directoryPath = file.getAbsolutePath();
} }
defaultPreferences.edit().putString(importExportDataPathKey, directoryPath).apply(); defaultPreferences.edit().putString(importExportDataPathKey, directoryPath).apply();
} }