Skip to content

Commit

Permalink
优化路径后缀修改
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Nov 11, 2023
1 parent 24ca1a7 commit d6801f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions BBDown/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public static async Task DownloadPageAsync(MyOption myOption, VInfo vInfo, Dicti
if (!Directory.Exists(_outSubPath.Split('/').First()))
Directory.CreateDirectory(_outSubPath.Split('/').First());
}
_outSubPath = _outSubPath[.._outSubPath.LastIndexOf('.')] + $".{s.lan}.srt";
_outSubPath = Path.ChangeExtension(_outSubPath, $".{s.lan}.srt");
File.Move(s.path, _outSubPath, true);
}
}
Expand Down Expand Up @@ -478,8 +478,8 @@ public static async Task DownloadPageAsync(MyOption myOption, VInfo vInfo, Dicti

if (downloadDanmaku)
{
var danmakuXmlPath = savePath[..savePath.LastIndexOf('.')] + ".xml";
var danmakuAssPath = savePath[..savePath.LastIndexOf('.')] + ".ass";
var danmakuXmlPath = Path.ChangeExtension(savePath, ".xml");
var danmakuAssPath = Path.ChangeExtension(savePath, ".ass");
Log("正在下载弹幕Xml文件");
string danmakuUrl = $"https://comment.bilibili.com/{p.cid}.xml";
await DownloadFile(danmakuUrl, danmakuXmlPath, downloadConfig);
Expand Down Expand Up @@ -507,7 +507,7 @@ public static async Task DownloadPageAsync(MyOption myOption, VInfo vInfo, Dicti
if (myOption.CoverOnly)
{
var coverUrl = pic == "" ? p.cover! : pic;
var newCoverPath = savePath[..savePath.LastIndexOf('.')] + Path.GetExtension(coverUrl);
var newCoverPath = Path.ChangeExtension(savePath, Path.GetExtension(coverUrl));
await DownloadFile(coverUrl, newCoverPath, downloadConfig);
if (Directory.Exists(p.aid) && Directory.GetFiles(p.aid).Length == 0) Directory.Delete(p.aid, true);
continue;
Expand Down

0 comments on commit d6801f1

Please sign in to comment.