Skip to content

Commit 2e84d7e

Browse files
committed
Directory check first
1 parent 8818313 commit 2e84d7e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Program.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ internal static bool ContainsArg(string arg) {
5050
static void Main(string[] args)
5151
{
5252
try {
53+
if (CheckMutex()) {
54+
// Don't run program if it's already running, instead we focus the already existing window
55+
NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_FOCUSINST, IntPtr.Zero, IntPtr.Zero);
56+
return;
57+
}
58+
59+
if (!Directory.Exists(DataLocation)) Directory.CreateDirectory(DataLocation);
60+
5361
Logger.Log("Initializing logging.");
5462

5563
Directory.SetCurrentDirectory(ProgramDirectory);
@@ -61,14 +69,6 @@ static void Main(string[] args)
6169
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
6270
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
6371

64-
if (CheckMutex()) {
65-
// Don't run program if it's already running, instead we focus the already existing window
66-
NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_FOCUSINST, IntPtr.Zero, IntPtr.Zero);
67-
return;
68-
}
69-
70-
if (!Directory.Exists(DataLocation)) Directory.CreateDirectory(DataLocation);
71-
7272
LANG.Initialize();
7373
Updater.CheckPostUpdate(args);
7474

0 commit comments

Comments
 (0)