mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Create parent directory when creating database.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
KeePassDroid (0.9.5)
|
||||
* Add notification based username and password copy
|
||||
* Add German translations
|
||||
* Try to create parent directory when creating database
|
||||
|
||||
KeePassdroid (0.9.4)
|
||||
* Add French translation
|
||||
|
||||
@@ -54,8 +54,10 @@
|
||||
<string name="entry_user_name">User Name: </string>
|
||||
<string name="error_can_not_handle_uri">KeePassDroid cannot handle this uri.</string>
|
||||
<string name="error_could_not_create_group">Error creating group.</string>
|
||||
<string name="error_could_not_create_parent">Could not create parent directory.</string>
|
||||
<string name="error_database_exists">This file already exists.</string>
|
||||
<string name="error_database_settings">Failed to determine database settings.</string>
|
||||
<string name="error_invalid_path">Invalid path.</string>
|
||||
<string name="error_failed_to_launch_link">Failed to launch link.</string>
|
||||
<string name="error_filename_required">A filename is required.</string>
|
||||
<string name="error_file_not_create">Could not create file:</string>
|
||||
|
||||
@@ -114,6 +114,25 @@ public class FileSelectActivity extends ListActivity {
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
File parent = file.getParentFile();
|
||||
|
||||
if ( parent.exists() && ! parent.isDirectory() ) {
|
||||
Toast.makeText(FileSelectActivity.this,
|
||||
R.string.error_invalid_path,
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! parent.exists() ) {
|
||||
// Create parent dircetory
|
||||
if ( ! parent.mkdirs() ) {
|
||||
Toast.makeText(FileSelectActivity.this,
|
||||
R.string.error_could_not_create_parent,
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user