@@ -764,21 +764,26 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
764764
765765 // initialize the memory manager early
766766 initMemoryManager ();
767-
768- // / @todo remove this force set of working directory later
769- Char buffer[ _MAX_PATH ];
770- GetModuleFileName ( NULL , buffer, sizeof ( buffer ) );
771- Char *pEnd = buffer + strlen ( buffer );
772- while ( pEnd != buffer )
767+
768+ CommandLine::parseCommandLineForStartup ();
769+
770+ if (TheGlobalData->m_changeCurrentWorkingDirectoryToExecutablePath )
773771 {
774- if ( *pEnd == ' \\ ' )
772+ // / @todo remove this force set of working directory later
773+ Char buffer[ _MAX_PATH ];
774+ GetModuleFileName ( NULL , buffer, sizeof ( buffer ) );
775+ Char *pEnd = buffer + strlen ( buffer );
776+ while ( pEnd != buffer )
775777 {
776- *pEnd = 0 ;
777- break ;
778+ if ( *pEnd == ' \\ ' )
779+ {
780+ *pEnd = 0 ;
781+ break ;
782+ }
783+ pEnd--;
778784 }
779- pEnd-- ;
785+ ::SetCurrentDirectory (buffer) ;
780786 }
781- ::SetCurrentDirectory (buffer);
782787
783788
784789 #ifdef RTS_DEBUG
@@ -799,7 +804,6 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
799804 // Force to be loaded from a file, not a resource so same exe can be used in germany and retail.
800805 gLoadScreenBitmap = (HBITMAP)LoadImage (hInstance, " Install_Final.bmp" , IMAGE_BITMAP, 0 , 0 , LR_SHARED|LR_LOADFROMFILE);
801806
802- CommandLine::parseCommandLineForStartup ();
803807
804808 // register windows class and create application window
805809 if (!TheGlobalData->m_headless && initializeAppWindows (hInstance, nCmdShow, TheGlobalData->m_windowed ) == false )
0 commit comments