diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-09-13 17:32:02 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-09-13 17:32:02 -0400 |
| commit | 14de062681026157c6917779a51af6fb7046cec2 (patch) | |
| tree | fe72ade31e1ef3874e0ed71684fe8ed819e43cc0 /MediaBrowser.Server.Startup.Common/FFMpeg | |
| parent | 0f743205c4835d828de9f28f6ab7d325209e83b2 (diff) | |
update file system methods
Diffstat (limited to 'MediaBrowser.Server.Startup.Common/FFMpeg')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs | 16 | ||||
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs index fe7cd943a2..16864898a6 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs @@ -78,11 +78,11 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg Version = version }; - Directory.CreateDirectory(versionedDirectoryPath); + _fileSystem.CreateDirectory(versionedDirectoryPath); var excludeFromDeletions = new List<string> { versionedDirectoryPath }; - if (!File.Exists(info.ProbePath) || !File.Exists(info.EncoderPath)) + if (!_fileSystem.FileExists(info.ProbePath) || !_fileSystem.FileExists(info.EncoderPath)) { // ffmpeg not present. See if there's an older version we can start with var existingVersion = GetExistingVersion(info, rootEncoderPath); @@ -218,7 +218,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg var tempFolder = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString()); - Directory.CreateDirectory(tempFolder); + _fileSystem.CreateDirectory(tempFolder); try { @@ -237,7 +237,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg })) { var targetFile = Path.Combine(targetFolder, Path.GetFileName(file)); - File.Copy(file, targetFile, true); + _fileSystem.CopyFile(file, targetFile, true); SetFilePermissions(targetFile); } } @@ -301,13 +301,13 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg { var fontsDirectory = Path.Combine(targetPath, "fonts"); - Directory.CreateDirectory(fontsDirectory); + _fileSystem.CreateDirectory(fontsDirectory); const string fontFilename = "ARIALUNI.TTF"; var fontFile = Path.Combine(fontsDirectory, fontFilename); - if (File.Exists(fontFile)) + if (_fileSystem.FileExists(fontFile)) { await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false); } @@ -350,7 +350,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg { try { - File.Copy(existingFile, Path.Combine(fontsDirectory, fontFilename), true); + _fileSystem.CopyFile(existingFile, Path.Combine(fontsDirectory, fontFilename), true); return; } catch (IOException ex) @@ -412,7 +412,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg const string fontConfigFilename = "fonts.conf"; var fontConfigFile = Path.Combine(fontsDirectory, fontConfigFilename); - if (!File.Exists(fontConfigFile)) + if (!_fileSystem.FileExists(fontConfigFile)) { var contents = string.Format("<?xml version=\"1.0\"?><fontconfig><dir>{0}</dir><alias><family>Arial</family><prefer>Arial Unicode MS</prefer></alias></fontconfig>", fontsDirectory); diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs index 124a7f74b3..384111addb 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs @@ -51,7 +51,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg string output = null; try { - output = File.ReadAllText(cachePath, Encoding.UTF8); + output = _fileSystem.ReadAllText(cachePath, Encoding.UTF8); } catch { @@ -71,8 +71,8 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg try { - Directory.CreateDirectory(Path.GetDirectoryName(cachePath)); - File.WriteAllText(cachePath, output, Encoding.UTF8); + _fileSystem.CreateDirectory(Path.GetDirectoryName(cachePath)); + _fileSystem.WriteAllText(cachePath, output, Encoding.UTF8); } catch { |
