Environment.GetFolderPath is not working properly in Linux

Prabs 1 Reputation point
2021-05-10T09:12:47.46+00:00

Hi,

I have a C#.Net core 3.1 console application which supports on Linux server.
I have created log file folder path by using Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) path.
In Redhat, the folder path created on my computer.
But in CENTOS the folder path created on "/home/User/"

I need to create folder path in Redhat "/home/User/" through root user.

Please help me on this issue.

Developer technologies .NET .NET Runtime
Developer technologies .NET Other
Developer technologies .NET .NET CLI
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-06-10T18:24:51.277+00:00

    MyComputer is not typically defined cross platform. There is a mapping to an environment variable for different distributions

    Red hat.

    dotnet-special-folder-api-linux

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.