-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathApplication_Paths.cs
More file actions
63 lines (60 loc) · 2.06 KB
/
Application_Paths.cs
File metadata and controls
63 lines (60 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace NetLock_RMM_User_Process
{
internal class Application_Paths
{
public static string application_data_debug_txt = Path.Combine(GetBasePath_CommonApplicationData(), "NetLock RMM User Process", "debug.txt");
public static string application_data_logs = Path.Combine(GetBasePath_CommonApplicationData(), "NetLock RMM User Process", "Logs");
private static string GetBasePath_CommonApplicationData()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "/var";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return "/Library/Application Support";
}
else if (OperatingSystem.IsMacOS())
{
return "/Library/Application Support";
}
else
{
throw new NotSupportedException("Unsupported OS");
}
}
private static string GetBasePath_ProgramFiles()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "/usr";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return "/Applications";
}
else if (OperatingSystem.IsMacOS())
{
return "/Applications";
}
else
{
throw new NotSupportedException("Unsupported OS");
}
}
}
}