forked from walcon/genie3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LocalDirectory.cs
34 lines (30 loc) · 986 Bytes
/
LocalDirectory.cs
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
using System;
using System.Windows.Forms;
namespace GenieClient
{
static class LocalDirectory
{
public static string Path = Application.StartupPath;
public static bool IsLocal = true;
public static void CheckUserDirectory()
{
string dir = System.IO.Path.Combine(Application.StartupPath, "Config");
if (!System.IO.Directory.Exists(dir))
{
// No local settings, change to user data directory
SetUserDataDirectory();
}
}
public static void SetUserDataDirectory()
{
string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
dir = System.IO.Path.Combine(dir, Application.ProductName);
if (!System.IO.Directory.Exists(dir))
{
System.IO.Directory.CreateDirectory(dir);
}
Path = dir;
IsLocal = false;
}
}
}