getDefaultScanPaths function
Implementation
Future<List<String>> getDefaultScanPaths() async {
final paths = <String>[];
final home =
Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'] ?? '';
if (Platform.isWindows) {
final letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
for (var l in letters) {
final drive = '$l:/';
if (Directory(drive).existsSync()) {
paths.add(drive);
final user = Platform.environment['USERNAME'] ?? '';
paths.addAll([
'$drive/Users/$user/Desktop',
'$drive/Users/$user/Documents',
'$drive/Users/$user/Downloads',
]);
}
}
} else if (Platform.isMacOS) {
paths.addAll([
'/Applications',
'$home/Desktop',
'$home/Documents',
'$home/Downloads',
'$home/Projects',
]);
} else if (Platform.isLinux) {
paths.addAll([
'/usr/local/',
'/opt/',
// ignore: unnecessary_string_interpolations
'$home',
'$home/Desktop',
'$home/Documents',
]);
}
return paths;
}