create parent folder if needed
fix line breaks

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiaskaminsky 2018-01-22 16:28:26 +01:00 committed by Mario Danic
parent c1a72a4b4b
commit 544c4723b9
4 changed files with 10 additions and 7 deletions

View file

@ -322,7 +322,9 @@ public class PushUtils {
FileOutputStream keyFileOutputStream = null;
try {
if (!new File(path).exists()) {
new File(path).createNewFile();
File newFile = new File(path);
newFile.getParentFile().mkdirs();
newFile.createNewFile();
}
keyFileOutputStream = new FileOutputStream(path);
keyFileOutputStream.write(encoded);

View file

@ -221,9 +221,7 @@ public class MainApp extends MultiDexApplication {
String storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH, "");
if (TextUtils.isEmpty(storagePath)) {
if (appPrefs.getInt(WhatsNewActivity.KEY_LAST_SEEN_VERSION_CODE, 0) != 0) {
/*
We already used the app, but no storage is set - fix that! :)
*/
// We already used the app, but no storage is set - fix that!
appPrefs.edit().putString(Preferences.PreferenceKeys.STORAGE_PATH,
Environment.getExternalStorageDirectory().getAbsolutePath()).commit();
appPrefs.edit().remove(PreferenceManager.PREF__KEYS_MIGRATION).commit();
@ -271,7 +269,8 @@ public class MainApp extends MultiDexApplication {
updateAutoUploadEntries();
if (getAppContext() != null) {
if (PermissionUtil.checkSelfPermission(getAppContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
if (PermissionUtil.checkSelfPermission(getAppContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
splitOutAutoUploadEntries();
} else {
PreferenceManager.setAutoUploadSplitEntries(getAppContext(), true);

View file

@ -53,7 +53,8 @@ public class EnvironmentStoragePointProvider extends AbstractStoragePointProvide
if (env != null) {
for (String p : env.split(":")) {
if (canBeAddedToAvailableList(result, p)) {
result.add(new StoragePoint(p, p, StoragePoint.StorageType.EXTERNAL, StoragePoint.PrivacyType.PUBLIC));
result.add(new StoragePoint(p, p, StoragePoint.StorageType.EXTERNAL,
StoragePoint.PrivacyType.PUBLIC));
}
}
}

View file

@ -65,7 +65,8 @@ public class VDCStoragePointProvider extends AbstractCommandLineStoragePoint {
final String path = vdcLine[2];
if (canBeAddedToAvailableList(result, path)) {
result.add(new StoragePoint(description, path, StoragePoint.StorageType.EXTERNAL, StoragePoint.PrivacyType.PRIVATE));
result.add(new StoragePoint(description, path, StoragePoint.StorageType.EXTERNAL,
StoragePoint.PrivacyType.PRIVATE));
}
} catch (NumberFormatException e) {