mirror of
https://github.com/Sonarr/Sonarr
synced 2025-02-22 06:01:24 +00:00
create data folder if doesn't exist.
This commit is contained in:
parent
0d6d9a7021
commit
6d3a604677
2 changed files with 24 additions and 12 deletions
|
@ -20,7 +20,7 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
private readonly Environment.SpecialFolder DATA_SPECIAL_FOLDER = Environment.SpecialFolder.CommonApplicationData;
|
private readonly Environment.SpecialFolder DATA_SPECIAL_FOLDER = Environment.SpecialFolder.CommonApplicationData;
|
||||||
|
|
||||||
|
|
||||||
public AppFolderInfo (IDiskProvider diskProvider)
|
public AppFolderInfo(IDiskProvider diskProvider)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
|
|
||||||
|
@ -31,10 +31,12 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
|
|
||||||
_logger = LogManager.GetCurrentClassLogger();
|
_logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
AppDataFolder = Path.Combine(Environment.GetFolderPath(DATA_SPECIAL_FOLDER, Environment.SpecialFolderOption.DoNotVerify), "NzbDrone");
|
AppDataFolder = Path.Combine(Environment.GetFolderPath(DATA_SPECIAL_FOLDER, Environment.SpecialFolderOption.Create), "NzbDrone");
|
||||||
StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
|
StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
|
||||||
TempFolder = Path.GetTempPath();
|
TempFolder = Path.GetTempPath();
|
||||||
|
|
||||||
|
diskProvider.EnsureFolder(AppDataFolder);
|
||||||
|
|
||||||
if (!OsInfo.IsLinux)
|
if (!OsInfo.IsLinux)
|
||||||
{
|
{
|
||||||
SetPermissions();
|
SetPermissions();
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Datastore.Migration.Framework
|
namespace NzbDrone.Core.Datastore.Migration.Framework
|
||||||
{
|
{
|
||||||
|
@ -24,11 +25,20 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
|
||||||
private static readonly Regex SchemaRegex = new Regex(@"['\""\[](?<name>\w+)['\""\]]\s(?<schema>[\w-\s]+)",
|
private static readonly Regex SchemaRegex = new Regex(@"['\""\[](?<name>\w+)['\""\]]\s(?<schema>[\w-\s]+)",
|
||||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||||
|
|
||||||
public SQLiteMigrationHelper(IConnectionStringFactory connectionStringFactory)
|
public SQLiteMigrationHelper(IConnectionStringFactory connectionStringFactory,Logger logger)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_connection = new SQLiteConnection(connectionStringFactory.MainDbConnectionString);
|
_connection = new SQLiteConnection(connectionStringFactory.MainDbConnectionString);
|
||||||
_connection.Open();
|
_connection.Open();
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.ErrorException("Couldn't open databse " + connectionStringFactory.MainDbConnectionString, e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private string GetOriginalSql(string tableName)
|
private string GetOriginalSql(string tableName)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue