From 0755d229e3d67c896e441af22e93371fb56c466f Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 29 Nov 2011 20:24:41 +0000 Subject: WinGui: Fix to the autoname function {source_path} option. It would sometimes use a directory 1 level up from where it was supposed to. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4368 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Functions/Main.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'win/CS/Functions') diff --git a/win/CS/Functions/Main.cs b/win/CS/Functions/Main.cs index 728747864..28909b403 100644 --- a/win/CS/Functions/Main.cs +++ b/win/CS/Functions/Main.cs @@ -245,7 +245,11 @@ namespace Handbrake.Functions if (UserSettingService.GetUserSetting(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}") && !string.IsNullOrEmpty(mainWindow.sourcePath)) { string savedPath = UserSettingService.GetUserSetting(UserSettingConstants.AutoNamePath).Trim().Replace("{source_path}\\", string.Empty).Replace("{source_path}", string.Empty); - string requestedPath = Path.Combine(Path.GetDirectoryName(mainWindow.sourcePath), savedPath); + + string directory = Directory.Exists(mainWindow.sourcePath) + ? mainWindow.sourcePath + : Path.GetDirectoryName(mainWindow.sourcePath); + string requestedPath = Path.Combine(directory, savedPath); autoNamePath = Path.Combine(requestedPath, destinationFilename); if (autoNamePath == mainWindow.sourcePath) -- cgit v1.2.3