fix save subtitle on win

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-10 12:09:01 +08:00
parent 963181fef2
commit 0f06de0047

View File

@@ -1136,8 +1136,15 @@ class HeaderControlState extends State<HeaderControl> {
res.headers.map,
),
);
final name =
String name =
'${introController.videoDetail.value.title}-${videoDetailCtr.bvid}-${videoDetailCtr.cid.value}-${item.lanDoc}.json';
if (Platform.isWindows) {
// Reserved characters may not be used in file names. See: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
name = name.replaceAll(
RegExp(r'[<>:/\\|?*"]'),
'',
);
}
Utils.saveBytes2File(
name: name,
bytes: bytes,