Skip to content

Commit

Permalink
Directory check first
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Dec 30, 2024
1 parent 8818313 commit 2e84d7e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ internal static bool ContainsArg(string arg) {
static void Main(string[] args)
{
try {
if (CheckMutex()) {
// Don't run program if it's already running, instead we focus the already existing window
NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_FOCUSINST, IntPtr.Zero, IntPtr.Zero);
return;
}

if (!Directory.Exists(DataLocation)) Directory.CreateDirectory(DataLocation);

Logger.Log("Initializing logging.");

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

if (CheckMutex()) {
// Don't run program if it's already running, instead we focus the already existing window
NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_FOCUSINST, IntPtr.Zero, IntPtr.Zero);
return;
}

if (!Directory.Exists(DataLocation)) Directory.CreateDirectory(DataLocation);

LANG.Initialize();
Updater.CheckPostUpdate(args);

Expand Down

0 comments on commit 2e84d7e

Please sign in to comment.