Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move config file to Roaming Appdata folder #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
using System.IO;
using System;
using System.IO;
using Newtonsoft.Json;

namespace EveOPreview.Configuration.Implementation
{
class ConfigurationStorage : IConfigurationStorage
{
private const string CONFIGURATION_FILE_NAME = "EVE-O Preview.json";
private const string CONFIGURATION_DIRECTORY_NAME = "EVE-O Preview";
private string _configurationFile;

private readonly IAppConfig _appConfig;
private readonly IAppConfig _appConfig;
private readonly IThumbnailConfiguration _thumbnailConfiguration;

public ConfigurationStorage(IAppConfig appConfig, IThumbnailConfiguration thumbnailConfiguration)
{
this._appConfig = appConfig;
this._thumbnailConfiguration = thumbnailConfiguration;
}
this._thumbnailConfiguration = thumbnailConfiguration;
//%appdata%/roaming/EVE-O Preview/EVE-O Preview.json
string configurationPath = Directory.CreateDirectory(
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CONFIGURATION_DIRECTORY_NAME)).FullName;
_configurationFile = Path.Combine(configurationPath, CONFIGURATION_FILE_NAME);
}

public void Load()
{
Expand Down Expand Up @@ -50,7 +57,7 @@ public void Save()

private string GetConfigFileName()
{
return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? ConfigurationStorage.CONFIGURATION_FILE_NAME : this._appConfig.ConfigFileName;
return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? _configurationFile : this._appConfig.ConfigFileName;
}
}
}