1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-23 16:27:44 +00:00

Changed app settings location to longer require root on unix

This commit is contained in:
unknown 2015-07-11 10:29:20 -06:00
parent a0987d9b50
commit 7cbad21e0b

View file

@ -18,7 +18,7 @@ namespace Jackett
{
class Program
{
public static string AppConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
public static string AppConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Jackett");
public static Server ServerInstance { get; private set; }
@ -36,6 +36,8 @@ namespace Jackett
{
ExitEvent = new ManualResetEvent(false);
MigrateSettingsDirectory();
try
{
if (!Directory.Exists(AppConfigDirectory))
@ -111,6 +113,22 @@ namespace Jackett
Console.WriteLine("Server thread exit");
}
static void MigrateSettingsDirectory()
{
try
{
string oldDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
if (Directory.Exists(oldDir) && !Directory.Exists(AppConfigDirectory))
{
Directory.Move(oldDir, AppConfigDirectory);
}
}
catch (Exception ex)
{
Console.WriteLine("ERROR could not migrate settings directory " + ex);
}
}
static void ReadSettingsFile()
{
var path = Path.Combine(AppConfigDirectory, "config.json");