mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Added string escape for DemuxConcatArgument
Fixes issue when source files have a ``'`` in their path
This commit is contained in:
parent
7461407f92
commit
21d1df824f
1 changed files with 10 additions and 1 deletions
|
@ -16,8 +16,17 @@ public class DemuxConcatArgument : IInputArgument
|
||||||
public readonly IEnumerable<string> Values;
|
public readonly IEnumerable<string> Values;
|
||||||
public DemuxConcatArgument(IEnumerable<string> values)
|
public DemuxConcatArgument(IEnumerable<string> values)
|
||||||
{
|
{
|
||||||
Values = values.Select(value => $"file '{value}'");
|
Values = values.Select(value => $"file '{Escape(value)}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thanks slhck
|
||||||
|
/// https://superuser.com/a/787651/1089628
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string Escape(string value) => value.Replace("'", @"'\''");
|
||||||
|
|
||||||
private readonly string _tempFileName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, $"concat_{Guid.NewGuid()}.txt");
|
private readonly string _tempFileName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, $"concat_{Guid.NewGuid()}.txt");
|
||||||
|
|
||||||
public void Pre() => File.WriteAllLines(_tempFileName, Values);
|
public void Pre() => File.WriteAllLines(_tempFileName, Values);
|
||||||
|
|
Loading…
Reference in a new issue