Skip to content

Commit

Permalink
修复Windows系统下文件夹命名bug
Browse files Browse the repository at this point in the history
Fix bug with download path for Windows
  • Loading branch information
jiangtian616 committed Jul 19, 2022
1 parent 785ae02 commit 9c8c69f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/src/service/gallery_download_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,9 @@ class GalleryDownloadService extends GetxController {
}

String _computeGalleryDownloadPath(GalleryDownloadedData gallery) {
String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ');
title = title.trim();
String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ').trim();
if (title.length > _maxTitleLength) {
title = title.substring(0, _maxTitleLength);
title = title.substring(0, _maxTitleLength).trim();
}
return path.join(
DownloadSetting.downloadPath.value,
Expand All @@ -561,10 +560,9 @@ class GalleryDownloadService extends GetxController {
String _computeImageDownloadRelativePath(GalleryDownloadedData gallery, int serialNo, {GalleryImage? image}) {
image ??= gid2Images[gallery.gid]![serialNo]!;
String ext = image.url.split('.').last;
String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ');
title = title.trim();
String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ').trim();
if (title.length > _maxTitleLength) {
title = title.substring(0, _maxTitleLength);
title = title.substring(0, _maxTitleLength).trim();
}

return path.relative(
Expand All @@ -580,9 +578,9 @@ class GalleryDownloadService extends GetxController {
String _computeImageDownloadAbsolutePath(GalleryDownloadedData gallery, int serialNo) {
GalleryImage image = gid2Images[gallery.gid]![serialNo]!;
String ext = image.url.split('.').last;
String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ');
String title = gallery.title.replaceAll(RegExp(r'[/|?,:*"<>]'), ' ').trim();
if (title.length > _maxTitleLength) {
title = title.substring(0, _maxTitleLength);
title = title.substring(0, _maxTitleLength).trim();
}

return path.join(
Expand Down

0 comments on commit 9c8c69f

Please sign in to comment.