mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 03:32:20 +08:00
微调自定义路径
This commit is contained in:
parent
bcb78ccf42
commit
e02f96dcd8
|
@ -449,6 +449,7 @@ namespace BililiveRecorder.Core
|
|||
if (!filename.EndsWith(".flv", StringComparison.OrdinalIgnoreCase))
|
||||
filename += ".flv";
|
||||
|
||||
filename = filename.RemoveInvalidFileName(ignore_slash: true);
|
||||
filename = Path.Combine(_config.WorkDirectory, filename);
|
||||
filename = Path.GetFullPath(filename);
|
||||
|
||||
|
|
|
@ -40,10 +40,12 @@ namespace BililiveRecorder.Core
|
|||
}
|
||||
}
|
||||
|
||||
internal static string RemoveInvalidFileName(this string name)
|
||||
internal static string RemoveInvalidFileName(this string name, bool ignore_slash = false)
|
||||
{
|
||||
foreach (char c in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
if (ignore_slash && (c == '\\' || c == '/'))
|
||||
continue;
|
||||
name = name.Replace(c, '_');
|
||||
}
|
||||
return name;
|
||||
|
|
Loading…
Reference in New Issue
Block a user