Fixed bug with deleting directories

Fixes #6
This commit is contained in:
Boris Timofeev 2017-03-22 18:48:27 +03:00
parent cd86ae9188
commit 4538bcea11
9 changed files with 17 additions and 1 deletions

View file

@ -169,7 +169,9 @@ public class WorkerService extends IntentService {
} else {
errorMsg = e.getMessage();
}
FileUtils.deleteQuietly(outputFile);
if (outputFile.isFile()) {
FileUtils.deleteQuietly(outputFile);
}
} finally {
stopForeground(true);
}

View file

@ -232,6 +232,10 @@ public class CreatePatchFragment extends ActionFragment implements View.OnClickL
@Override
public void onClick(DialogInterface dialog, int which) {
String newName = input.getText().toString();
if (newName.equals("")) {
Toast.makeText(getActivity(), R.string.dialog_rename_error_empty_name, Toast.LENGTH_LONG).show();
return;
}
if (newName.contains("/")) {
newName = newName.replaceAll("/", "_");
Toast.makeText(getActivity(), R.string.dialog_rename_error_invalid_chars, Toast.LENGTH_LONG).show();

View file

@ -248,6 +248,10 @@ public class PatchingFragment extends ActionFragment implements View.OnClickList
@Override
public void onClick(DialogInterface dialog, int which) {
String newName = input.getText().toString();
if (newName.equals("")) {
Toast.makeText(getActivity(), R.string.dialog_rename_error_empty_name, Toast.LENGTH_LONG).show();
return;
}
if (newName.contains("/")) {
newName = newName.replaceAll("/", "_");
Toast.makeText(getActivity(), R.string.dialog_rename_error_invalid_chars, Toast.LENGTH_LONG).show();

View file

@ -23,6 +23,7 @@
<string name="dialog_rename_cancel">Cancelar</string>
<string name="dialog_rename_error_same_name">Los nombres de archivos de entrada y salida deben ser diferentes</string>
<string name="dialog_rename_error_invalid_chars">Símbolo no válido /</string>
<string name="dialog_rename_error_empty_name">File name can not be empty</string>
<!-- Create patch fragment -->
<string name="create_patch_fragment_source_file">Archivo fuente</string>

View file

@ -23,6 +23,7 @@
<string name="dialog_rename_cancel">Cancella</string>
<string name="dialog_rename_error_same_name">The input and output file names must be different</string>
<string name="dialog_rename_error_invalid_chars">Simbolo non valido /</string>
<string name="dialog_rename_error_empty_name">File name can not be empty</string>
<!-- Create patch fragment -->
<string name="create_patch_fragment_source_file">Source file</string>

View file

@ -23,6 +23,7 @@
<string name="dialog_rename_cancel">Anuluj</string>
<string name="dialog_rename_error_same_name">The input and output file names must be different</string>
<string name="dialog_rename_error_invalid_chars">Niewłaściwy symbol /</string>
<string name="dialog_rename_error_empty_name">File name can not be empty</string>
<!-- Create patch fragment -->
<string name="create_patch_fragment_source_file">Source file</string>

View file

@ -23,6 +23,7 @@
<string name="dialog_rename_cancel">Отмена</string>
<string name="dialog_rename_error_same_name">Имена файлов должны отличаться</string>
<string name="dialog_rename_error_invalid_chars">Некорректный символ /</string>
<string name="dialog_rename_error_empty_name">Имя файла не может быть пустым</string>
<!-- Create patch fragment -->
<string name="create_patch_fragment_source_file">Исходный файл</string>

View file

@ -23,6 +23,7 @@
<string name="dialog_rename_cancel">Скасувати</string>
<string name="dialog_rename_error_same_name">The input and output file names must be different</string>
<string name="dialog_rename_error_invalid_chars">Недійсний символ /</string>
<string name="dialog_rename_error_empty_name">File name can not be empty</string>
<!-- Create patch fragment -->
<string name="create_patch_fragment_source_file">Source file</string>

View file

@ -23,6 +23,7 @@
<string name="dialog_rename_cancel">Cancel</string>
<string name="dialog_rename_error_same_name">The input and output file names must be different</string>
<string name="dialog_rename_error_invalid_chars">Invalid symbol /</string>
<string name="dialog_rename_error_empty_name">File name can not be empty</string>
<!-- Create patch fragment -->
<string name="create_patch_fragment_source_file">Source file</string>