Honour `$BIZHAWK_DATA_HOME` when downloading FFmpeg

also stop looking for `/ffmpeg.exe` in DiscoHawk when it's always downloaded to
`/dll/ffmpeg.exe`
This commit is contained in:
YoshiRulz 2022-05-31 01:42:40 +10:00
parent b8d5dd8990
commit 7f87cc258f
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 5 additions and 5 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.IO;
using BizHawk.Common;
using BizHawk.Common.PathExtensions;
using BizHawk.Emulation.DiscSystem;
using OSTC = EXE_PROJECT.OSTailoredCode;
@ -73,10 +74,7 @@ namespace BizHawk.Client.DiscoHawk
OSTC.LinkedLibManager.FreeByPtr(lib);
}
var ffmpegPath = Path.Combine(GetExeDirectoryAbsolute(), "ffmpeg.exe");
if (!File.Exists(ffmpegPath))
ffmpegPath = Path.Combine(Path.Combine(GetExeDirectoryAbsolute(), "dll"), "ffmpeg.exe");
FFmpegService.FFmpegPath = ffmpegPath;
FFmpegService.FFmpegPath = Path.Combine(PathUtils.DataDirectoryPath, "dll", OSTC.IsUnixHost ? "ffmpeg" : "ffmpeg.exe");
if (args.Length == 0)
{

View File

@ -89,6 +89,8 @@ namespace BizHawk.Client.EmuHawk
if (exiting)
return;
DirectoryInfo parentDir = new(Path.GetDirectoryName(FFmpegService.FFmpegPath)!);
if (!parentDir.Exists) parentDir.Create();
File.WriteAllBytes(FFmpegService.FFmpegPath, data);
if (OSTailoredCode.IsUnixHost)
{

View File

@ -155,7 +155,7 @@ namespace BizHawk.Client.EmuHawk
initialConfig.ResolveDefaults();
// initialConfig should really be globalConfig as it's mutable
FFmpegService.FFmpegPath = Path.Combine(PathUtils.DllDirectoryPath, OSTC.IsUnixHost ? "ffmpeg" : "ffmpeg.exe");
FFmpegService.FFmpegPath = Path.Combine(PathUtils.DataDirectoryPath, "dll", OSTC.IsUnixHost ? "ffmpeg" : "ffmpeg.exe");
StringLogUtil.DefaultToDisk = initialConfig.Movies.MoviesOnDisk;