mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Make Mono.Posix usage conditional on .NET Core
This commit is contained in:
41
src/Jackett.Server/Services/FilePermissionService.cs
Normal file
41
src/Jackett.Server/Services/FilePermissionService.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Jackett.Common.Services.Interfaces;
|
||||
using NLog;
|
||||
using System;
|
||||
#if NETCOREAPP2_2
|
||||
using Mono.Unix;
|
||||
#endif
|
||||
|
||||
namespace Jackett.Server.Services
|
||||
{
|
||||
public class FilePermissionService : IFilePermissionService
|
||||
{
|
||||
private Logger logger;
|
||||
|
||||
public FilePermissionService(Logger l)
|
||||
{
|
||||
logger = l;
|
||||
}
|
||||
|
||||
public void MakeFileExecutable(string path)
|
||||
{
|
||||
#if NETCOREAPP2_2
|
||||
|
||||
//Calling the file permission service to limit usage to netcoreapp. The Mono.Posix.NETStandard library causes issues outside of .NET Core
|
||||
//https://github.com/xamarin/XamarinComponents/issues/282
|
||||
|
||||
logger.Debug($"Attempting to give execute permission to: {path}");
|
||||
try
|
||||
{
|
||||
UnixFileInfo jackettUpdaterFI = new UnixFileInfo(path)
|
||||
{
|
||||
FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute | FileAccessPermissions.GroupRead | FileAccessPermissions.OtherRead
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user