mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-02 11:34:08 +02:00
Move log file path to a separate property and make sure it always has the correct path
This commit is contained in:
parent
707b4b4ba2
commit
3c17c36f4f
12
Program.cs
12
Program.cs
@ -27,6 +27,12 @@ static class Program{
|
|||||||
|
|
||||||
public static UserConfig UserConfig { get; private set; }
|
public static UserConfig UserConfig { get; private set; }
|
||||||
|
|
||||||
|
public static string LogFile{
|
||||||
|
get{
|
||||||
|
return Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"td-log.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
||||||
public static extern IntPtr LoadLibrary(string name);
|
public static extern IntPtr LoadLibrary(string name);
|
||||||
|
|
||||||
@ -90,14 +96,14 @@ public static void HandleException(string message, Exception e){
|
|||||||
Log(e.ToString());
|
Log(e.ToString());
|
||||||
|
|
||||||
if (MessageBox.Show(message+"\r\nDo you want to open the log file to report the issue?",BrandName+" Has Failed :(",MessageBoxButtons.YesNo,MessageBoxIcon.Error,MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
if (MessageBox.Show(message+"\r\nDo you want to open the log file to report the issue?",BrandName+" Has Failed :(",MessageBoxButtons.YesNo,MessageBoxIcon.Error,MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"td-log.txt"));
|
Process.Start(LogFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Log(string data){
|
public static void Log(string data){
|
||||||
StringBuilder build = new StringBuilder();
|
StringBuilder build = new StringBuilder();
|
||||||
|
|
||||||
if (!File.Exists("td-log.txt")){
|
if (!File.Exists(LogFile)){
|
||||||
build.Append("Please, report all issues to: https://github.com/chylex/TweetDick/issues\r\n\r\n");
|
build.Append("Please, report all issues to: https://github.com/chylex/TweetDick/issues\r\n\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +111,7 @@ public static void Log(string data){
|
|||||||
build.Append(data).Append("\r\n\r\n");
|
build.Append(data).Append("\r\n\r\n");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
File.AppendAllText("td-log.txt",build.ToString(),Encoding.UTF8);
|
File.AppendAllText(LogFile,build.ToString(),Encoding.UTF8);
|
||||||
}catch{
|
}catch{
|
||||||
// oops
|
// oops
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user