Skip to content

Commit

Permalink
Fix GUI mode check
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeltris committed Nov 13, 2020
1 parent 156fa9e commit 26c0aa7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion GK6X/GK6X-gui.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
call %WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe GK6X.csproj /p:Configuration=Debug /p:OutputType=Winexe /p:AssemblyName=GK6X-gui
call %WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe GK6X.csproj /p:Configuration=Debug /p:OutputType=Winexe /p:AssemblyName=GK6X-gui /p:DefineConstants=AS_GUI
15 changes: 4 additions & 11 deletions GK6X/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ class Program

static void Main(string[] args)
{
#if AS_GUI
Run(asGUI: true);
#else
Run(asGUI: false);
#endif
Stop();
}

Expand All @@ -36,17 +40,6 @@ static void Stop()

static void Run(bool asGUI)
{
try
{
if (Process.GetCurrentProcess().MainWindowHandle == IntPtr.Zero)
{
asGUI = true;
}
}
catch
{
}

BasePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
DataBasePath = Path.Combine(BasePath, DataBasePath);
UserDataPath = Path.Combine(BasePath, UserDataPath);
Expand Down

0 comments on commit 26c0aa7

Please sign in to comment.