summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2019-02-21 20:00:21 +0000
committersr55 <[email protected]>2019-02-21 20:00:49 +0000
commite66b3f440283669f9c82fe9fb33438ee968047c8 (patch)
treeddce45b448a40e2a27f9e5d19def3c1d454c0b80 /win/CS
parentc6cde0de9f3f6b1d50b5dc736cbb3fb30d4ffdb8 (diff)
WinGui: Attempt to be smarter with the Autonaming when dealing with directories with ".". Fixes #1917
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs26
1 files changed, 16 insertions, 10 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 6bbeee2ed..ddabf080e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -421,20 +421,19 @@ namespace HandBrakeWPF.ViewModels
get
{
// Sanity Check
- if (ScannedSource == null || ScannedSource.ScanPath == null)
+ if (this.ScannedSource == null || this.ScannedSource.ScanPath == null || this.selectedTitle == null)
{
return string.Empty;
}
- // The title that is selected has a source name. This means it's part of a batch scan.
- if (selectedTitle != null && !string.IsNullOrEmpty(selectedTitle.SourceName) && !selectedTitle.SourceName.EndsWith("\\"))
+ if (File.Exists(this.ScannedSource.ScanPath)) // Scan Path is a File.
{
- return Path.GetFileNameWithoutExtension(selectedTitle.SourceName);
+ return Path.GetFileNameWithoutExtension(this.ScannedSource.ScanPath);
}
- // Check if we have a Folder, if so, check if it's a DVD / Bluray drive and get the label.
- if (ScannedSource.ScanPath.EndsWith("\\"))
+ if (Directory.Exists(this.ScannedSource.ScanPath)) // Scan Path is a folder.
{
+ // Check to see if it's a Drive. If yes, use the volume label.
foreach (DriveInformation item in DriveUtilities.GetDrives())
{
if (item.RootDirectory.Contains(this.ScannedSource.ScanPath.Replace("\\\\", "\\")))
@@ -442,12 +441,19 @@ namespace HandBrakeWPF.ViewModels
return item.VolumeLabel;
}
}
- }
- if (Path.GetFileNameWithoutExtension(this.ScannedSource.ScanPath) != "VIDEO_TS")
- return Path.GetFileNameWithoutExtension(this.ScannedSource.ScanPath);
+ // Otherwise, it may be a path of files.
+ if (!string.IsNullOrEmpty(this.selectedTitle.SourceName) && File.Exists(this.selectedTitle.SourceName)) // Selected Title is a file
+ {
+ return Path.GetFileNameWithoutExtension(this.selectedTitle.SourceName);
+ }
+ else if (Directory.Exists(this.selectedTitle.SourceName)) // Selected Title is a structured source.
+ {
+ return Path.GetFileName(this.ScannedSource.ScanPath);
+ }
+ }
- return Path.GetFileNameWithoutExtension(Path.GetDirectoryName(this.ScannedSource.ScanPath));
+ return null;
}
}