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:
parent
a0987d9b50
commit
7cbad21e0b
1 changed files with 19 additions and 1 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue