${SegmentFile}

${Segment.OnInit}
	System::Call kernel32::GetCurrentProcess()i.s
	System::Call kernel32::IsWow64Process(is,*i.r0)
	
	${If} $0 == 0 ;32-bit
		StrCpy $1 "32"
		StrCpy $2 "64"
	${Else}
		StrCpy $1 "64"
		StrCpy $2 "32"
	${EndIf}
	
	${If} ${FileExists} "$EXEDIR\App\Ferdium$2\chrome_100_percent.pak"
		Rename "$EXEDIR\App\Ferdium$2\chrome_100_percent.pak" "$EXEDIR\App\Ferdium$1\chrome_100_percent.pak"
		Rename "$EXEDIR\App\Ferdium$2\chrome_200_percent.pak" "$EXEDIR\App\Ferdium$1\chrome_200_percent.pak"
		Rename "$EXEDIR\App\Ferdium$2\icudtl.dat" "$EXEDIR\App\Ferdium$1\icudtl.dat"
		Rename "$EXEDIR\App\Ferdium$2\resources.pak" "$EXEDIR\App\Ferdium$1\resources.pak"
		Rename "$EXEDIR\App\Ferdium$2\locales" "$EXEDIR\App\Ferdium$1\locales"
		Rename "$EXEDIR\App\Ferdium$2\resources\app.asar.unpacked" "$EXEDIR\App\Ferdium$1\resources\app.asar.unpacked"
		Sleep 100
	${EndIf}
!macroend

${SegmentInit}
    ${If} $Bits = 64
        ${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Ferdium64"
	${Else}
        ${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Ferdium32"
	${EndIf}
!macroend