mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 01:01:10 +00:00
Updates code to account for MacOS as a UNIX platform
This commit is contained in:
1 parent
d32f124147
commit
01decb27d5
4 files changed
+6
-8
No files matched your search
+3
-3
@@ -40,7 +40,7 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
|
||||
{
|
||||
PlatformType platformType = _platformContextManager.GetCurrentContext().Platform;
|
||||
if (platformType == PlatformType.Unix)
|
||||
return CanAccessPathLinux(path.Path, accessMode);
|
||||
return CanAccessPathUnix(path.Path, accessMode);
|
||||
else if (platformType == PlatformType.Windows)
|
||||
#pragma warning disable CA1416 // Validate platform compatibility
|
||||
return CanAccessPathWindows(path.Path, accessMode, isFile);
|
||||
@@ -50,13 +50,13 @@ internal class FileSystemPermissionsService : IFileSystemPermissionsService // T
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a the current user has access permissions on Linux for <paramref name="path"/>, with <paramref name="accessMode"/>.
|
||||
/// Checks if a the current user has access permissions on Unix for <paramref name="path"/>, with <paramref name="accessMode"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path for which to check the access.</param>
|
||||
/// <param name="accessMode">The access mode in which to check that path access.</param>
|
||||
/// <returns><see langword="true"/> if the current user has rights for the specified path and acccess mode, <see langword="false"/> otherwise.</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown when trying to check access for a mode that is not supported</exception>
|
||||
private static bool CanAccessPathLinux(string path, FileAccessMode accessMode)
|
||||
private static bool CanAccessPathUnix(string path, FileAccessMode accessMode)
|
||||
{
|
||||
AccessModes modes;
|
||||
UnixFileSystemInfo fileInfo = new UnixFileInfo(path);
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class PlatformContextManager : IPlatformContextManager
|
||||
{
|
||||
// set a default context if none is set
|
||||
if (_currentPlatformContext is null)
|
||||
if (_operatingSystemInfo.IsOSPlatform(OSPlatform.Linux))
|
||||
if (_operatingSystemInfo.IsOSPlatform(OSPlatform.Linux) || _operatingSystemInfo.IsOSPlatform(OSPlatform.OSX))
|
||||
SetCurrentPlatform(PlatformType.Unix);
|
||||
else
|
||||
SetCurrentPlatform(PlatformType.Windows);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<BaseOutputPath>$(SolutionDir)..\bin\web\</BaseOutputPath>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<UserSecretsId>6413036f-92d7-45d8-a8B1-205200089047</UserSecretsId>
|
||||
<UserSecretsId>10a94da9-18ed-4c70-a9da-b461e08958c4</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<ContainerRepository>lumina-web</ContainerRepository>
|
||||
<DockerfileTag>lumina-web</DockerfileTag>
|
||||
@@ -35,7 +35,5 @@
|
||||
<!--disable warnings generated by Mediator source generator-->
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);TS6385</NoWarn>
|
||||
<UserSecretsId>10a94da9-18ed-4c70-a9da-b461e08958c4</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -35,7 +35,7 @@ public class FileSystemBrowserViewComponent : ViewComponent
|
||||
{
|
||||
return View(new
|
||||
{
|
||||
Path = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? @"/" : @"C:\Users\",
|
||||
Path = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? @"/" : @"C:\Users\",
|
||||
ServerBasePath = $"{_serverConfigurationModel.BaseAddress}:{_serverConfigurationModel.Port}/api/v{_serverConfigurationModel.ApiVersion}/",
|
||||
ClientBasePath = "http://localhost:5012/", // TODO: take from appsettings or environment
|
||||
ViewMode = FileSystemViewMode.List,
|
||||
|
||||
Reference in new issue
Block a user