Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a141840 authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Gerrit Code Review
Browse files

Merge "CMFM: Fix change to root when initial directory not exists" into cm-10.1

parents af6c2e7b 57ab2195
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@
  <string name="msgs_settings_save_failure">The setting could not be applied or stored.</string>
  <!-- The initial directory has an invalid or inaccessible reference -->
  <string name="msgs_settings_invalid_initial_directory">The initial folder
    "<xliff:g id="initial_dir">%1$s</xliff:g>" is invalid. Changing to root folder.</string>
    \"<xliff:g id="initial_dir">%1$s</xliff:g>\" is invalid. Changing to root folder.</string>

  <!-- Success -->
  <string name="msgs_success">The operation was completed successfully.</string>
+16 −3
Original line number Diff line number Diff line
@@ -620,6 +620,8 @@ public class NavigationActivity extends Activity
                                StorageHelper.getStorageVolumes(NavigationActivity.this);
                        if (volumes != null && volumes.length > 0) {
                            initialDir = volumes[0].getPath();
                            //Ensure that initial directory is an absolute directory
                            initialDir = FileHelper.getAbsPath(initialDir);
                        } else {
                            // Show exception and exit
                            DialogHelper.showToast(
@@ -628,10 +630,21 @@ public class NavigationActivity extends Activity
                            exit();
                            return;
                        }
                    }

                    } else {
                        //Ensure that initial directory is an absolute directory
                        initialDir = FileHelper.getAbsPath(initialDir);
                        File f = new File(initialDir);
                        if (!f.exists()) {
                            // Change to root directory
                            DialogHelper.showToast(
                                    NavigationActivity.this,
                                    getString(
                                            R.string.msgs_settings_invalid_initial_directory,
                                            initialDir),
                                    Toast.LENGTH_SHORT);
                            initialDir = FileHelper.ROOT_DIRECTORY;
                        }
                    }

                    // Change the current directory to the preference initial directory
                    navigationView.changeCurrentDir(initialDir);