check if destination file already exists

This commit is contained in:
tibbi 2016-11-05 22:20:11 +01:00
parent 44e268b441
commit 62a665493f
7 changed files with 14 additions and 6 deletions

View File

@ -62,6 +62,14 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String
return@setOnClickListener
}
if (files.size == 1) {
val newFile = File(files[0].path)
if (File(destinationPath, newFile.name).exists()) {
context.toast(R.string.already_exists)
return@setOnClickListener
}
}
if (view.dialog_radio_group.checkedRadioButtonId == R.id.dialog_radio_copy) {
context.toast(R.string.copying)
val pair = Pair<List<File>, File>(files, destinationDir)

View File

@ -33,7 +33,7 @@
<string name="copy_failed">Konnte die Datei nicht kopieren</string>
<string name="copying">Kopiere</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="already_exists">A file with that name already exists</string>
<string name="ok">OK</string>
<string name="cancel">Abbrechen</string>
<string name="press_back_again">Drücke erneut zum Schließen</string>

View File

@ -33,7 +33,7 @@
<string name="copy_failed">Impossibile copiare i file</string>
<string name="copying">Copia in corso</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="already_exists">A file with that name already exists</string>
<string name="ok">OK</string>
<string name="cancel">Annulla</string>
<string name="press_back_again">Premi di nuovo indietro per uscire</string>

View File

@ -33,7 +33,7 @@
<string name="copy_failed">ファイルをコピーできませんでした</string>
<string name="copying">コピー中</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">ホーム</string>
<string name="already_exists">A file with that name already exists</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="press_back_again">Press back again to exit</string>

View File

@ -33,7 +33,7 @@
<string name="copy_failed">Não foi possível copiar os ficheiros</string>
<string name="copying">A copiar</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">início</string>
<string name="already_exists">A file with that name already exists</string>
<string name="ok">OK</string>
<string name="cancel">Cancelar</string>
<string name="press_back_again">Press back again to exit</string>

View File

@ -33,7 +33,7 @@
<string name="copy_failed">Kunde inte kopiera filen</string>
<string name="copying">Kopierar</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="already_exists">A file with that name already exists</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="press_back_again">Press back again to exit</string>

View File

@ -33,7 +33,7 @@
<string name="copy_failed">Could not copy the files</string>
<string name="copying">Copying</string>
<string name="copying_no_delete">Copying, please delete source files manually</string>
<string name="initial_breadcrumb">home</string>
<string name="already_exists">A file with that name already exists</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="press_back_again">Press back again to exit</string>