${SegmentFile}

${SegmentInit}
	ReadRegStr $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentBuild"
	
	${If} $0 < 10000
		;Windows 7/8/8.1
		StrCpy $Bits 32
	${EndIf}

    ${If} $Bits = 64
		${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Qalculate64"
		${If} ${FileExists} "$EXEDIR\App\Qalculate\doc\*.*"
			Rename "$EXEDIR\App\Qalculate\doc" "$EXEDIR\App\Qalculate64\doc"
			Rename "$EXEDIR\App\Qalculate\locale" "$EXEDIR\App\Qalculate64\locale"
			Rename "$EXEDIR\App\Qalculate\pixmaps" "$EXEDIR\App\Qalculate64\pixmaps"
			Rename "$EXEDIR\App\Qalculate\share" "$EXEDIR\App\Qalculate64\share"
		${EndIf}
	${Else}
		${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Qalculate"
		${If} ${FileExists} "$EXEDIR\App\Qalculate64\doc\*.*"
			Rename "$EXEDIR\App\Qalculate64\doc" "$EXEDIR\App\Qalculate\doc"
			Rename "$EXEDIR\App\Qalculate64\locale" "$EXEDIR\App\Qalculate\locale"
			Rename "$EXEDIR\App\Qalculate64\pixmaps" "$EXEDIR\App\Qalculate\pixmaps"
			Rename "$EXEDIR\App\Qalculate64\share" "$EXEDIR\App\Qalculate\share"
		${EndIf}
	${EndIf}
!macroend
