Winforms получает путь к рабочему столу как в Windows, так и в Linux (с использованием Wine).C#

Место общения программистов C#
Anonymous
Winforms получает путь к рабочему столу как в Windows, так и в Linux (с использованием Wine).

Сообщение Anonymous »


I have a Winforms app written in C#, which is also used on Linux machines, and it runs fine using Wine. I only have a problem with getting the path to the Desktop when running on Linux (Wine). In the code I'm using Environment.GetFolderPath(Environment.SpecialFolder.Desktop) to get the Desktop path. It returns 'C:\Users\user\Desktop' (both on Windows and Linux), but when running under Wine, this folder is a part of a simulated Windows environment within Wine, and not the actual Linux desktop, which is '/home/user/Desktop'. My questions are:
  • How to detect from my app if it's running on Windows or Linux (Wine)?
  • If the app is running on Linux (Wine), how can I get the actual Linux desktop path, instead of 'C:\Users\user\Desktop'?

Thanks

I tried searching for "c# get desktop path on linux", but nothing useful comes up.


Источник: https://stackoverflow.com/questions/780 ... using-wine

Вернуться в «C#»