Fix invalid image order when exporting comic as pdf.

This commit is contained in:
2025-02-08 19:37:04 +08:00
parent f0b1135eb7
commit ce50812857
2 changed files with 9 additions and 15 deletions

View File

@@ -35,19 +35,9 @@ class FilePath {
}
extension FileSystemEntityExt on FileSystemEntity {
/// Get the base name of the file or directory.
String get name {
var path = this.path;
if (path.endsWith('/') || path.endsWith('\\')) {
path = path.substring(0, path.length - 1);
}
int i = path.length - 1;
while (i >= 0 && path[i] != '\\' && path[i] != '/') {
i--;
}
return path.substring(i + 1);
return p.basename(path);
}
Future<void> deleteIgnoreError({bool recursive = false}) async {
@@ -83,6 +73,10 @@ extension FileExtension on File {
// Stream is not usable since [AndroidFile] does not support [openRead].
await newFile.writeAsBytes(await readAsBytes());
}
String get basenameWithoutExt {
return p.basenameWithoutExtension(path);
}
}
extension DirectoryExtension on Directory {