mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Merge pull request #13 from vladjerca/fix/path_resolution
FFMpegOptions: build paths using the `Combine` util
Former-commit-id: 7438f497ad
This commit is contained in:
commit
116775eb2b
1 changed files with 8 additions and 8 deletions
|
@ -8,8 +8,8 @@ namespace FFMpegCore.FFMPEG
|
||||||
{
|
{
|
||||||
public class FFMpegOptions
|
public class FFMpegOptions
|
||||||
{
|
{
|
||||||
private static string _ConfigFile = $".{Path.DirectorySeparatorChar}ffmpeg.config.json";
|
private static string _ConfigFile = Path.Combine(".", "ffmpeg.config.json");
|
||||||
private static string _DefaultRoot = $".{Path.DirectorySeparatorChar}FFMPEG{Path.DirectorySeparatorChar}bin";
|
private static string _DefaultRoot = Path.Combine(".", "FFMPEG", "bin");
|
||||||
|
|
||||||
public static FFMpegOptions Options { get; private set; } = new FFMpegOptions();
|
public static FFMpegOptions Options { get; private set; } = new FFMpegOptions();
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ public string FFmpegBinary
|
||||||
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
||||||
var progName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffmpeg.exe" : "ffmpeg";
|
var progName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffmpeg.exe" : "ffmpeg";
|
||||||
|
|
||||||
if (Directory.Exists($"{Options.RootDirectory}{target}"))
|
if (Directory.Exists(Path.Combine(Options.RootDirectory, target)))
|
||||||
{
|
{
|
||||||
progName = $"{target}{Path.DirectorySeparatorChar}{progName}";
|
progName = Path.Combine(target, progName);
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = $"{Options.RootDirectory}{Path.DirectorySeparatorChar}{progName}";
|
var path = Path.Combine(Options.RootDirectory, progName);
|
||||||
|
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
||||||
|
@ -57,12 +57,12 @@ public string FFProbeBinary
|
||||||
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
var target = Environment.Is64BitProcess ? "x64" : "x86";
|
||||||
var progName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffprobe.exe" : "ffprobe";
|
var progName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ffprobe.exe" : "ffprobe";
|
||||||
|
|
||||||
if (Directory.Exists($"{Options.RootDirectory}{target}"))
|
if (Directory.Exists(Path.Combine(Options.RootDirectory, target)))
|
||||||
{
|
{
|
||||||
progName = $"{target}{Path.DirectorySeparatorChar}{progName}";
|
progName = Path.Combine(target, progName);
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = $"{Options.RootDirectory}{Path.DirectorySeparatorChar}{progName}";
|
var path = Path.Combine(Options.RootDirectory, progName);
|
||||||
|
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
throw new FFMpegException(FFMpegExceptionType.Dependency,
|
||||||
|
|
Loading…
Reference in a new issue