2013-06-28 00:04:52 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Common.EnvironmentInfo
|
|
|
|
|
{
|
|
|
|
|
public interface IAppDirectoryInfo
|
|
|
|
|
{
|
|
|
|
|
string WorkingDirectory { get; }
|
|
|
|
|
string SystemTemp { get; }
|
|
|
|
|
string StartUpPath { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class AppDirectoryInfo : IAppDirectoryInfo
|
|
|
|
|
{
|
|
|
|
|
|
2013-06-28 01:03:04 +00:00
|
|
|
|
public AppDirectoryInfo()
|
2013-06-28 00:04:52 +00:00
|
|
|
|
{
|
2013-06-28 01:03:04 +00:00
|
|
|
|
WorkingDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create), "NzbDrone");
|
|
|
|
|
StartUpPath = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
|
|
|
|
|
SystemTemp = Path.GetTempPath();
|
2013-06-28 00:04:52 +00:00
|
|
|
|
|
2013-06-28 01:03:04 +00:00
|
|
|
|
if (!Directory.Exists(WorkingDirectory))
|
2013-06-28 00:04:52 +00:00
|
|
|
|
{
|
2013-06-28 01:03:04 +00:00
|
|
|
|
Directory.CreateDirectory(WorkingDirectory);
|
2013-06-28 00:04:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-28 01:03:04 +00:00
|
|
|
|
|
|
|
|
|
public string WorkingDirectory { get; private set; }
|
|
|
|
|
|
|
|
|
|
public string StartUpPath { get; private set; }
|
|
|
|
|
|
|
|
|
|
public String SystemTemp { get; private set; }
|
2013-06-28 00:04:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|