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
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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