fix(main): file name
This commit is contained in:
@@ -399,7 +399,7 @@ class AppService extends ChangeNotifier {
|
||||
final content = nearbyFile.info;
|
||||
final downloadsDir = Directory('storage/emulated/0/Download');
|
||||
final newFile = await nearbyFile.file.copy(
|
||||
'${downloadsDir.path}/${content.name}',
|
||||
'${downloadsDir.path}/${DateTime.now().microsecondsSinceEpoch}.${content.extension}',
|
||||
);
|
||||
files.add(newFile);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,14 @@ class NearbyFileInfo {
|
||||
}
|
||||
}
|
||||
|
||||
String get extension {
|
||||
try {
|
||||
return name.split('.').last;
|
||||
} catch (e) {
|
||||
throw NearbyServiceException('Can\'t get extension from $name');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NearbyFileInfo{path: $path}';
|
||||
|
||||
Reference in New Issue
Block a user