diff options
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/ScanService.cs | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs | 15 |
2 files changed, 16 insertions, 6 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs index cc94a3f7d..cd9eb834a 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs @@ -21,7 +21,7 @@ namespace HandBrake.ApplicationServices.Services /// <summary>
/// Scan a Source
/// </summary>
- public class ScanService : IScan
+ public class ScanService : IScan
{
#region Private Variables
@@ -210,6 +210,11 @@ namespace HandBrake.ApplicationServices.Services logDir,
string.Format("last_scan_log{0}.txt", GeneralUtilities.GetInstanceCount));
+ if (!Directory.Exists(logDir))
+ {
+ Directory.CreateDirectory(logDir);
+ }
+
// Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file)
if (File.Exists(dvdInfoPath))
{
diff --git a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs index b663cf2bf..da349c417 100644 --- a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs @@ -72,14 +72,12 @@ namespace HandBrakeWPF.Helpers cliProcess.Start();
// Retrieve standard output and report back to parent thread until the process is complete
+ bool success = false;
TextReader stdOutput = cliProcess.StandardError;
-
- while (!cliProcess.HasExited)
+ while ((line = stdOutput.ReadLine()) != null)
{
- line = stdOutput.ReadLine() ?? string.Empty;
Match m = Regex.Match(line, @"HandBrake ([svnM0-9.]*) \(([0-9]*)\)");
Match platform = Regex.Match(line, @"- ([A-Za-z0-9\s ]*) -");
-
if (m.Success)
{
string version = m.Groups[1].Success ? m.Groups[1].Value : string.Empty;
@@ -90,6 +88,7 @@ namespace HandBrakeWPF.Helpers userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, buildValue);
userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeVersion, version);
+ success = true;
}
if (platform.Success)
@@ -97,7 +96,10 @@ namespace HandBrakeWPF.Helpers userSettingService.SetUserSetting(
ASUserSettingConstants.HandBrakePlatform, platform.Value.Replace("-", string.Empty).Trim());
}
+ }
+ while (!cliProcess.HasExited)
+ {
if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.
{
Process cli = Process.GetProcessById(cliProcess.Id);
@@ -108,7 +110,10 @@ namespace HandBrakeWPF.Helpers }
}
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeExeHash, base64Hash);
+ if (success)
+ {
+ userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeExeHash, base64Hash);
+ }
}
catch (Exception e)
{
|