mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 01:21:56 +01:00
use '_' instead ':' in exported and imported file names
This commit is contained in:
parent
c0fe15d38f
commit
bcc5afb78c
@ -236,7 +236,7 @@ public class DataManagementActivity extends AbstractGBActivity {
|
|||||||
SharedPreferences deviceSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier());
|
SharedPreferences deviceSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier());
|
||||||
if (sharedPrefs != null) {
|
if (sharedPrefs != null) {
|
||||||
File myPath = FileUtils.getExternalFilesDir();
|
File myPath = FileUtils.getExternalFilesDir();
|
||||||
File myFile = new File(myPath, "Export_preference_" + dbDevice.getIdentifier());
|
File myFile = new File(myPath, "Export_preference_" + FileUtils.makeValidFileName(dbDevice.getIdentifier()));
|
||||||
try {
|
try {
|
||||||
ImportExportSharedPreferences.exportToFile(deviceSharedPrefs, myFile, null);
|
ImportExportSharedPreferences.exportToFile(deviceSharedPrefs, myFile, null);
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
@ -264,7 +264,15 @@ public class DataManagementActivity extends AbstractGBActivity {
|
|||||||
SharedPreferences deviceSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier());
|
SharedPreferences deviceSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier());
|
||||||
if (sharedPrefs != null) {
|
if (sharedPrefs != null) {
|
||||||
File myPath = FileUtils.getExternalFilesDir();
|
File myPath = FileUtils.getExternalFilesDir();
|
||||||
File myFile = new File(myPath, "Export_preference_" + dbDevice.getIdentifier());
|
File myFile = new File(myPath, "Export_preference_" + FileUtils.makeValidFileName(dbDevice.getIdentifier()));
|
||||||
|
|
||||||
|
if (!myFile.exists()) { //first try to use file in new format de_ad_be_af, if doesn't exist use old format de:at:be:af
|
||||||
|
myFile = new File(myPath, "Export_preference_" + dbDevice.getIdentifier());
|
||||||
|
LOG.info("Trying to import with older filename");
|
||||||
|
}else{
|
||||||
|
LOG.info("Trying to import with new filename");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ImportExportSharedPreferences.importFromFile(deviceSharedPrefs, myFile);
|
ImportExportSharedPreferences.importFromFile(deviceSharedPrefs, myFile);
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
|
Loading…
Reference in New Issue
Block a user