diff options
author | [email protected] <sr55> | 2016-01-29 21:21:07 +0000 |
---|---|---|
committer | [email protected] <sr55> | 2016-01-29 21:21:07 +0000 |
commit | 8343b1cacf87f673a7e0b82c6cd1449d9c529edc (patch) | |
tree | d953661f4cecf1d7bf2e5f8f00a1767ce40d72e7 /win/CS/HandBrakeWPF/Services/Presets | |
parent | db29f87dc3bf3909d263491390d0f56418616e26 (diff) |
WinGui: Allow the Nightly build and Release version to be run side-by-side. The nightly build will store the config and presets file in a "Nightly" sub directory. If this directory doesn't exist, it'll create it and try port the release versions to it.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Presets')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Presets/PresetService.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index 9b470cb06..79d35e2ab 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -45,7 +45,7 @@ namespace HandBrakeWPF.Services.Presets public const int ForcePresetReset = 2;
public static string UserPresetCatgoryName = "User Presets";
- private readonly string presetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\presets.json";
+ private readonly string presetFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(VersionHelper.IsNightly()), "presets.json");
private readonly ObservableCollection<Preset> presets = new ObservableCollection<Preset>();
private readonly IErrorService errorService;
private readonly IUserSettingService userSettingService;
@@ -495,8 +495,17 @@ namespace HandBrakeWPF.Services.Presets // If we don't have a presets file. Create one for first load.
if (!File.Exists(this.presetFile))
{
- this.UpdateBuiltInPresets();
- return; // Update built-in presets stores the presets locally, so just return.
+ // If this is a nightly, and we don't have a presets file, try port the main version if it exists.
+ string releasePresetFile = Path.Combine(DirectoryUtilities.GetUserStoragePath(false), "presets.json");
+ if (VersionHelper.IsNightly() && File.Exists(releasePresetFile))
+ {
+ File.Copy(releasePresetFile, DirectoryUtilities.GetUserStoragePath(true));
+ }
+ else
+ {
+ this.UpdateBuiltInPresets();
+ return; // Update built-in presets stores the presets locally, so just return.
+ }
}
// Otherwise, we already have a file, so lets try load it.
|