check for already existing files or directories
This commit is contained in:
parent
42529d81ab
commit
1d45e4e0cb
|
@ -163,7 +163,11 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||
final EditText itemName = (EditText) newItemView.findViewById(R.id.item_name);
|
||||
final String name = itemName.getText().toString().trim();
|
||||
if (Utils.isNameValid(name)) {
|
||||
File file = new File(mPath, name);
|
||||
final File file = new File(mPath, name);
|
||||
if (file.exists()) {
|
||||
Utils.showToast(getContext(), R.string.name_taken);
|
||||
return;
|
||||
}
|
||||
final RadioGroup radio = (RadioGroup) newItemView.findViewById(R.id.dialog_radio_group);
|
||||
if (radio.getCheckedRadioButtonId() == R.id.dialog_radio_directory) {
|
||||
if (!createDirectory(file, alertDialog)) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<string name="create_new">Create new item</string>
|
||||
<string name="directory">Directory</string>
|
||||
<string name="file">File</string>
|
||||
<string name="name_taken">Directory or file with that name already exists</string>
|
||||
<string name="invalid_name">The name contains invalid characters</string>
|
||||
<string name="error_occurred">An unknown error occurred</string>
|
||||
<string name="delete">Delete</string>
|
||||
|
|
Loading…
Reference in New Issue