mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 09:35:12 +00:00
fix: Avoid collisions when save file on android
This commit is contained in:
parent
9c1c5a4aec
commit
759d96f406
1 changed files with 6 additions and 1 deletions
|
@ -50,7 +50,12 @@ extension MatrixFileExtension on MatrixFile {
|
||||||
|
|
||||||
Future<String> getDownloadPathAndroid() async {
|
Future<String> getDownloadPathAndroid() async {
|
||||||
final directory = await getDownloadDirectoryAndroid();
|
final directory = await getDownloadDirectoryAndroid();
|
||||||
return '${directory.path}/$name';
|
var counter = 1;
|
||||||
|
var path = '${directory.path}/$name';
|
||||||
|
while (await File(path).exists()) {
|
||||||
|
path = '${directory.path}/(${counter++})$name';
|
||||||
|
}
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Directory> getDownloadDirectoryAndroid() async {
|
Future<Directory> getDownloadDirectoryAndroid() async {
|
||||||
|
|
Loading…
Reference in a new issue