diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java
index 43bf8dbcc..c17e6a563 100644
--- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java
+++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java
@@ -304,6 +304,11 @@ public class MainActivity extends SimpleActivity
private void renameDir(final String path) {
final File dir = new File(path);
+ if (Utils.Companion.isAStorageRootFolder(this, path)) {
+ Utils.Companion.showToast(this, R.string.rename_folder_root);
+ return;
+ }
+
new RenameDirectoryDialog(this, dir, new RenameDirectoryDialog.OnRenameDirListener() {
@Override
public void onRenameDirSuccess(@NotNull String[] changedFiles) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt
index cf05cff6d..afa291954 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/Utils.kt
@@ -111,6 +111,11 @@ class Utils {
}
}
+ fun isAStorageRootFolder(context: Context, path: String): Boolean {
+ val trimmed = path.trimEnd('/')
+ return trimmed.isEmpty() || trimmed == context.getInternalStoragePath() || trimmed == context.getSDCardPath()
+ }
+
fun isPhotoVideo(file: File) = file.isPhotoVideo()
fun needsStupidWritePermissions(context: Context, path: String) = context.needsStupidWritePermissions(path)
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index c327681c1..897197e9f 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -16,6 +16,7 @@
Konnte den Ordner nicht umbenennen
Ordnername darf nicht leer sein
A folder with that name already exists
+ Cannot rename the root folder of a storage
Ordner erfolgreich umbenannt
Benenne Ordner um
Dateiname darf nicht leer sein
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 5afbc5261..de44644e3 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -16,6 +16,7 @@
No se pudo renombrar la carpeta
El nombre de carpeta no puede estar vacío
A folder with that name already exists
+ Cannot rename the root folder of a storage
Carpeta renombrada correctamente
Renombrando carpeta
El nombre de archivo no puede estar vacío
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index f4d4d1135..88f6cb67f 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -16,6 +16,7 @@
Impossibile rinominare la cartella
Il nome della cartella non deve essere vuoto
A folder with that name already exists
+ Cannot rename the root folder of a storage
Cartella rinominata correttamente
Rinominazione cartella
Il nome del file non deve essere vuoto
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index f52d9507e..b7164b390 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -16,6 +16,7 @@
フォルダーの名前を変更できませんでした
フォルダー名は空にできません
A folder with that name already exists
+ Cannot rename the root folder of a storage
フォルダーの名前を正常に変更しました
フォルダーの名前を変更中
ファイル名は空にできません
diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml
index 3fc2acf6f..d9623fb1c 100644
--- a/app/src/main/res/values-pt-rPT/strings.xml
+++ b/app/src/main/res/values-pt-rPT/strings.xml
@@ -16,6 +16,7 @@
Não foi possível renomear a pasta
O nome da pasta não pode estar vazio
A folder with that name already exists
+ Cannot rename the root folder of a storage
A pasta foi renomeada com sucesso
A renomear pasta
O nome do ficheiro não pode estar vazio
diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml
index d5f86d17c..1f148e01a 100644
--- a/app/src/main/res/values-sv/strings.xml
+++ b/app/src/main/res/values-sv/strings.xml
@@ -16,6 +16,7 @@
Det gick inte att döpa om mappen
Du måste ange ett mappnamn
A folder with that name already exists
+ Cannot rename the root folder of a storage
Mappen döptes om
Döper om mappen
Du måste ange ett filnamn
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index a08602d3f..a5b9b5c00 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -16,6 +16,7 @@
重命名文件夹
文件夹名不能为空
A folder with that name already exists
+ Cannot rename the root folder of a storage
文件夹不能重命名
文件夹重命名成功
重命名中..
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e1c084cef..42eca6dcd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -16,6 +16,7 @@
Could not rename the folder
Folder name must not be empty
A folder with that name already exists
+ Cannot rename the root folder of a storage
Folder renamed successfully
Renaming folder
Filename cannot be empty