-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from nini22P/dev
v1.3.1
- Loading branch information
Showing
12 changed files
with
106 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'dart:io'; | ||
import 'package:iris/utils/logger.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
import 'package:path/path.dart' as p; | ||
|
||
Future<bool> dataMigration() async { | ||
try { | ||
if (Platform.isWindows) { | ||
final String newDataPath = (await getApplicationSupportDirectory()).path; | ||
final String oldDataPath = | ||
p.normalize('$newDataPath/../../nini22p.iris/iris'); | ||
logger('newDataPath: $newDataPath'); | ||
logger('oldDataPath: $oldDataPath'); | ||
final bool newDataExist = | ||
await File('$newDataPath/flutter_secure_storage.dat').exists(); | ||
final bool oldDataExist = | ||
await File('$oldDataPath/flutter_secure_storage.dat').exists(); | ||
if (!newDataExist && oldDataExist) { | ||
logger('Find old data in $oldDataPath'); | ||
final Directory oldDir = Directory(oldDataPath); | ||
final Directory newDir = Directory(newDataPath); | ||
|
||
if (await oldDir.exists()) { | ||
if (!await newDir.exists()) { | ||
await newDir.create(recursive: true); | ||
} | ||
|
||
await for (var entity in oldDir.list()) { | ||
if (entity is File) { | ||
final String newFilePath = | ||
p.join(newDir.path, p.basename(entity.path)); | ||
await entity.copy(newFilePath); | ||
logger('Copied ${entity.path} to $newFilePath'); | ||
} | ||
} | ||
logger('Data migration completed'); | ||
return true; | ||
} | ||
} | ||
} | ||
} catch (e) { | ||
return false; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters