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.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,575 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
326 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,581 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,136 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,386 Reputation points
    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