clean up ffmpeg downloading

This commit is contained in:
Luke Pulverenti 2015-01-25 16:04:29 -05:00
parent 8b78b69f57
commit 91416cb8a8

View File

@ -228,9 +228,9 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
string.Equals(filename, downloadinfo.FFMpegFilename, StringComparison.OrdinalIgnoreCase); string.Equals(filename, downloadinfo.FFMpegFilename, StringComparison.OrdinalIgnoreCase);
})) }))
{ {
File.Copy(file, Path.Combine(targetFolder, Path.GetFileName(file)), true); var targetFile = Path.Combine(targetFolder, Path.GetFileName(file));
File.Copy(file, targetFile, true);
SetFilePermissions(targetFolder, file); SetFilePermissions(targetFile);
} }
} }
finally finally
@ -239,12 +239,12 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
} }
} }
private void SetFilePermissions(string targetFolder, string file) private void SetFilePermissions(string path)
{ {
// Linux: File permission to 666, and user's execute bit // Linux: File permission to 666, and user's execute bit
if (_environment.OperatingSystem == OperatingSystem.Bsd || _environment.OperatingSystem == OperatingSystem.Linux || _environment.OperatingSystem == OperatingSystem.Osx) if (_environment.OperatingSystem == OperatingSystem.Bsd || _environment.OperatingSystem == OperatingSystem.Linux || _environment.OperatingSystem == OperatingSystem.Osx)
{ {
Syscall.chmod(Path.Combine(targetFolder, Path.GetFileName(file)), FilePermissions.DEFFILEMODE | FilePermissions.S_IXUSR); Syscall.chmod(path, FilePermissions.DEFFILEMODE | FilePermissions.S_IXUSR);
} }
} }