mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
Added string escape for DemuxConcatArgument
Fixes issue when source files have a ``'`` in their path
Former-commit-id: 21d1df824f
This commit is contained in:
parent
c49a9b2721
commit
65bb8ecd2b
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