diff options
author | sr55 <[email protected]> | 2009-05-04 22:40:46 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-05-04 22:40:46 +0000 |
commit | ec848fee96e7cbfbb2037b1908978ebe45543e54 (patch) | |
tree | d861e2be4d7331f4d20c721aa684d2555d51130b /win/C#/Functions/Encode.cs | |
parent | 75d5f5f6e4064dae500ea3d3b034f3bfbf2393b8 (diff) |
WinGui:
# New
- Setup LibDVDNav option for scanning.
# Directory and logging changes
- The GUI now stores preset data in the systems user Application Data directory. This means that multi-user systems don't share the same single set of user presets.
- A History of logs are automatically stored in the systems application data directory.
- Changed the log preferences to make them a bit easier to understand.
# Bugs / Typos
- Fixed small bug in the version info regex parser.
- Fixed typo on x264 tab
- Fixed minor GUI issue on the Add Preset window (button transparency)
- Fixed disable Query Editor tab option (Thanks tlindgren)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2383 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions/Encode.cs')
-rw-r--r-- | win/C#/Functions/Encode.cs | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index 6c30828c2..1579528a6 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -136,31 +136,38 @@ namespace Handbrake.Functions public void copyLog(string destination)
{
// The user may wish to do something with the log.
- if (Properties.Settings.Default.saveLog == "Checked")
+ if (Properties.Settings.Default.saveLogToSpecifiedPath == "Checked")
{
- string logPath = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat");
-
- if (Properties.Settings.Default.saveLogWithVideo == "Checked")
+ try
{
- string[] destName = destination.Split('\\');
- string destinationFile = "";
- for (int i = 0; i < destName.Length - 1; i++)
- {
- destinationFile += destName[i] + "\\";
- }
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ string tempLogFile = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat");
- destinationFile += DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + destName[destName.Length - 1] + ".txt";
+ string encodeDestinationPath = Path.GetDirectoryName(destination);
+ String[] destName = destination.Split('\\');
+ string destinationFile = destName[destName.Length - 1];
+ string encodeLogFile = DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + destinationFile + ".txt";
- File.Copy(logPath, destinationFile);
+ // Make sure the log directory exists.
+ if (!Directory.Exists(logDir))
+ Directory.CreateDirectory(logDir);
+
+ // Copy the Log to HandBrakes log folder in the users applciation data folder.
+ File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));
+
+ // Save a copy of the log file in the same location as the enocde.
+ if (Properties.Settings.Default.saveLogWithVideo == "Checked")
+ File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));
+
+ // Save a copy of the log file to a user specified location
+ if (Directory.Exists(Properties.Settings.Default.saveLogPath))
+ if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath == "Checked")
+ File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile));
}
- else if (Properties.Settings.Default.saveLogPath != String.Empty)
+ catch (Exception exc)
{
- string[] destName = destination.Split('\\');
- string dest = destName[destName.Length - 1];
- string filename = DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + dest + ".txt";
- string useDefinedLogPath = Path.Combine(Properties.Settings.Default.saveLogPath, filename);
-
- File.Copy(logPath, useDefinedLogPath);
+ MessageBox.Show("Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc, "Error",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
|