${SegmentFile}

${SegmentInit}
	ReadRegStr $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentBuild"
	
    ${If} $Bits = 64
        ${If} ${FileExists} "$EXEDIR\App\OpenMPT64\*.*"
			Rename "$EXEDIR\App\OpenMPT" "$EXEDIR\App\OpenMPT32"
			Rename "$EXEDIR\App\OpenMPT64" "$EXEDIR\App\OpenMPT"
			Rename "$EXEDIR\App\OpenMPT32\ExampleSongs" "$EXEDIR\App\OpenMPT\ExampleSongs"
			Rename "$EXEDIR\App\OpenMPT32\extraKeymaps" "$EXEDIR\App\OpenMPT\extraKeymaps"
			Rename "$EXEDIR\App\OpenMPT32\Licenses" "$EXEDIR\App\OpenMPT\Licenses"
			Rename "$EXEDIR\App\OpenMPT32\ReleaseNotesImages" "$EXEDIR\App\OpenMPT\ReleaseNotesImages"
			Rename "$EXEDIR\App\OpenMPT32\OpenMPT Manual.chm" "$EXEDIR\App\OpenMPT\OpenMPT Manual.chm"
			Rename "$EXEDIR\App\OpenMPT32\openmpt-wine-support.zip" "$EXEDIR\App\OpenMPT\openmpt-wine-support.zip"
			
			Rename "$EXEDIR\App\OpenMPT32\Components" "$EXEDIR\App\OpenMPT\Components"
			Rename "$EXEDIR\App\OpenMPT32\tunings" "$EXEDIR\App\OpenMPT\tunings"
			Rename "$EXEDIR\App\OpenMPT32\mptrack.ini" "$EXEDIR\App\OpenMPT\mptrack.ini"
			Rename "$EXEDIR\App\OpenMPT32\Keybindings.mkb" "$EXEDIR\App\OpenMPT\Keybindings.mkb"
			Rename "$EXEDIR\App\OpenMPT32\plugin.cache" "$EXEDIR\App\OpenMPT\plugin.cache"
			Rename "$EXEDIR\App\OpenMPT32\SongSettings.ini" "$EXEDIR\App\OpenMPT\SongSettings.ini"
		${EndIf}
	${Else}
        ${If} ${FileExists} "$EXEDIR\App\OpenMPT32\*.*"
			Rename "$EXEDIR\App\OpenMPT" "$EXEDIR\App\OpenMPT64"
			Rename "$EXEDIR\App\OpenMPT32" "$EXEDIR\App\OpenMPT"
			Rename "$EXEDIR\App\OpenMPT64\ExampleSongs" "$EXEDIR\App\OpenMPT\ExampleSongs"
			Rename "$EXEDIR\App\OpenMPT64\extraKeymaps" "$EXEDIR\App\OpenMPT\extraKeymaps"
			Rename "$EXEDIR\App\OpenMPT64\Licenses" "$EXEDIR\App\OpenMPT\Licenses"
			Rename "$EXEDIR\App\OpenMPT64\ReleaseNotesImages" "$EXEDIR\App\OpenMPT\ReleaseNotesImages"
			Rename "$EXEDIR\App\OpenMPT64\OpenMPT Manual.chm" "$EXEDIR\App\OpenMPT\OpenMPT Manual.chm"
			Rename "$EXEDIR\App\OpenMPT64\openmpt-wine-support.zip" "$EXEDIR\App\OpenMPT\openmpt-wine-support.zip"
			
			Rename "$EXEDIR\App\OpenMPT64\Components" "$EXEDIR\App\OpenMPT\Components"
			Rename "$EXEDIR\App\OpenMPT64\tunings" "$EXEDIR\App\OpenMPT\tunings"
			Rename "$EXEDIR\App\OpenMPT64\mptrack.ini" "$EXEDIR\App\OpenMPT\mptrack.ini"
			Rename "$EXEDIR\App\OpenMPT64\Keybindings.mkb" "$EXEDIR\App\OpenMPT\Keybindings.mkb"
			Rename "$EXEDIR\App\OpenMPT64\plugin.cache" "$EXEDIR\App\OpenMPT\plugin.cache"
			Rename "$EXEDIR\App\OpenMPT64\SongSettings.ini" "$EXEDIR\App\OpenMPT\SongSettings.ini"
		${EndIf}        
	${EndIf}
!macroend
