Skip to content

Commit

Permalink
[#] Create folder when output log
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Dec 12, 2017
1 parent 7138e59 commit 1327b59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions PasteEx/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static void Main(string[] args)
command = command.Substring(0, command.Length - 1);
}

Client.Start();
Application.Run(new FormMain(command));
}
else
Expand Down
9 changes: 7 additions & 2 deletions PasteEx/Util/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ namespace PasteEx.Util
/// </summary>
public static class Logger
{
private static string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "PasteEx", "PasteEx.log");

static Logger()
{
string folder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "PasteEx");
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}

string path = Path.Combine(folder, "PasteEx.log");
Trace.Listeners.Add(new TextWriterTraceListener(path));
Trace.AutoFlush = true;
}
Expand Down

0 comments on commit 1327b59

Please sign in to comment.