do not allow renaming the root folder of a storage
This commit is contained in:
parent
9b8420e9d1
commit
e013cc02a4
10 changed files with 18 additions and 0 deletions
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">Konnte den Ordner nicht umbenennen</string>
|
||||
<string name="rename_folder_empty">Ordnername darf nicht leer sein</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">Ordner erfolgreich umbenannt</string>
|
||||
<string name="renaming_folder">Benenne Ordner um</string>
|
||||
<string name="filename_cannot_be_empty">Dateiname darf nicht leer sein</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">No se pudo renombrar la carpeta</string>
|
||||
<string name="rename_folder_empty">El nombre de carpeta no puede estar vacío</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">Carpeta renombrada correctamente</string>
|
||||
<string name="renaming_folder">Renombrando carpeta</string>
|
||||
<string name="filename_cannot_be_empty">El nombre de archivo no puede estar vacío</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">Impossibile rinominare la cartella</string>
|
||||
<string name="rename_folder_empty">Il nome della cartella non deve essere vuoto</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">Cartella rinominata correttamente</string>
|
||||
<string name="renaming_folder">Rinominazione cartella</string>
|
||||
<string name="filename_cannot_be_empty">Il nome del file non deve essere vuoto</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">フォルダーの名前を変更できませんでした</string>
|
||||
<string name="rename_folder_empty">フォルダー名は空にできません</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">フォルダーの名前を正常に変更しました</string>
|
||||
<string name="renaming_folder">フォルダーの名前を変更中</string>
|
||||
<string name="filename_cannot_be_empty">ファイル名は空にできません</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">Não foi possível renomear a pasta</string>
|
||||
<string name="rename_folder_empty">O nome da pasta não pode estar vazio</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">A pasta foi renomeada com sucesso</string>
|
||||
<string name="renaming_folder">A renomear pasta</string>
|
||||
<string name="filename_cannot_be_empty">O nome do ficheiro não pode estar vazio</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">Det gick inte att döpa om mappen</string>
|
||||
<string name="rename_folder_empty">Du måste ange ett mappnamn</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">Mappen döptes om</string>
|
||||
<string name="renaming_folder">Döper om mappen</string>
|
||||
<string name="filename_cannot_be_empty">Du måste ange ett filnamn</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder">重命名文件夹</string>
|
||||
<string name="rename_folder_empty">文件夹名不能为空</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_error">文件夹不能重命名</string>
|
||||
<string name="rename_folder_ok">文件夹重命名成功</string>
|
||||
<string name="renaming_folder">重命名中..</string>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<string name="rename_folder_error">Could not rename the folder</string>
|
||||
<string name="rename_folder_empty">Folder name must not be empty</string>
|
||||
<string name="rename_folder_exists">A folder with that name already exists</string>
|
||||
<string name="rename_folder_root">Cannot rename the root folder of a storage</string>
|
||||
<string name="rename_folder_ok">Folder renamed successfully</string>
|
||||
<string name="renaming_folder">Renaming folder</string>
|
||||
<string name="filename_cannot_be_empty">Filename cannot be empty</string>
|
||||
|
|
Loading…
Reference in a new issue