mirror of
https://github.com/Jackett/Jackett
synced 2025-01-01 04:38:20 +00:00
Minor settings migration bug fix
This commit is contained in:
parent
7aecb9ac68
commit
c81c6b1e68
1 changed files with 14 additions and 10 deletions
|
@ -25,7 +25,7 @@ namespace Jackett.Services
|
||||||
string ApplicationFolder();
|
string ApplicationFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConfigurationService: IConfigurationService
|
public class ConfigurationService : IConfigurationService
|
||||||
{
|
{
|
||||||
private ISerializeService serializeService;
|
private ISerializeService serializeService;
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
@ -61,13 +61,17 @@ namespace Jackett.Services
|
||||||
foreach (var file in Directory.GetFiles(oldDir, "*", SearchOption.AllDirectories))
|
foreach (var file in Directory.GetFiles(oldDir, "*", SearchOption.AllDirectories))
|
||||||
{
|
{
|
||||||
var path = file.Replace(oldDir, "");
|
var path = file.Replace(oldDir, "");
|
||||||
var destFolder = GetAppDataFolder()+ path;
|
var destFolder = GetAppDataFolder() + path;
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(destFolder)))
|
if (!Directory.Exists(Path.GetDirectoryName(destFolder)))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(destFolder));
|
Directory.CreateDirectory(Path.GetDirectoryName(destFolder));
|
||||||
}
|
}
|
||||||
File.Move(file, destFolder);
|
if (!File.Exists(destFolder))
|
||||||
|
{
|
||||||
|
File.Move(file, destFolder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Directory.Delete(oldDir, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -90,7 +94,7 @@ namespace Jackett.Services
|
||||||
|
|
||||||
return serializeService.DeSerialise<T>(File.ReadAllText(fullPath));
|
return serializeService.DeSerialise<T>(File.ReadAllText(fullPath));
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
logger.Error(e, "Error reading config file " + fullPath);
|
logger.Error(e, "Error reading config file " + fullPath);
|
||||||
return default(T);
|
return default(T);
|
||||||
|
@ -147,12 +151,12 @@ namespace Jackett.Services
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetAppDataFolderStatic()
|
public static string GetAppDataFolderStatic()
|
||||||
{
|
{
|
||||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetIndexerConfigDir()
|
public string GetIndexerConfigDir()
|
||||||
{
|
{
|
||||||
return Path.Combine(GetAppDataFolder(), "Indexers");
|
return Path.Combine(GetAppDataFolder(), "Indexers");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetConfigFile()
|
public string GetConfigFile()
|
||||||
|
@ -173,13 +177,13 @@ namespace Jackett.Services
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
jsonReply = JObject.Parse(File.ReadAllText(path));
|
jsonReply = JObject.Parse(File.ReadAllText(path));
|
||||||
// Port = (int)jsonReply["port"];
|
// Port = (int)jsonReply["port"];
|
||||||
// ListenPublic = (bool)jsonReply["public"];
|
// ListenPublic = (bool)jsonReply["public"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// jsonReply["port"] = Port;
|
// jsonReply["port"] = Port;
|
||||||
// jsonReply["public"] = ListenPublic;
|
// jsonReply["public"] = ListenPublic;
|
||||||
}
|
}
|
||||||
return jsonReply;
|
return jsonReply;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue