Standardize Image Resizer naming (#14694)

* Standardize Image Resizer naming

* Use no-throw methods

* Do not move if new dir already exist

* Update test files paths
This commit is contained in:
Stefan Markovic
2021-12-02 09:08:43 +01:00
committed by GitHub
parent 22f8390ef9
commit 87f6278bf9
22 changed files with 26 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ namespace ImageResizer.Properties
// Used to synchronize access to the settings.json file
private static Mutex _jsonMutex = new Mutex();
private static string _settingsPath = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "ImageResizer", "settings.json");
private static string _settingsPath = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "Image Resizer", "settings.json");
private string _fileNameFormat;
private bool _shrinkOnly;
private int _selectedSizeIndex;
@@ -422,6 +422,14 @@ namespace ImageResizer.Properties
public void Reload()
{
string oldSettingsDir = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "ImageResizer");
string settingsDir = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "Image Resizer");
if (_fileSystem.Directory.Exists(oldSettingsDir) && !_fileSystem.Directory.Exists(settingsDir))
{
_fileSystem.Directory.Move(oldSettingsDir, settingsDir);
}
_jsonMutex.WaitOne();
if (!_fileSystem.File.Exists(SettingsPath))
{

View File

@@ -9,7 +9,7 @@ namespace ImageResizer.Properties
public class SettingsWrapper
{
[JsonPropertyName("name")]
public string Name { get; set; } = "ImageResizer";
public string Name { get; set; } = "Image Resizer";
[JsonPropertyName("version")]
public string Version { get; set; } = "1";