#!/usr/bin/perl -w use strict; use Win32::File; my $alienkey = 'msw_2_8_9_uni_mslu_gcc_3_4'; # check the OS Version # gdi plus is needed on 5.0 and below my ( $vdesc, $vmajor, $vminor, $vbuild, $osid, $spmajor, $spminor, $suitemask, $producttype) = Win32::GetOSVersion(); my $gdiplusnative = ( ( $vmajor < 5 ) || ( ( $vmajor == 5 ) && ( $vminor < 1 ) ) ) ? 0 : 1; exit(0) if $gdiplusnative; my $targetpart = qq(Alien/wxWidgets/$alienkey/lib/gdiplus.dll); my $sourcepart = qq(Alien/wxWidgets/$alienkey/os/gdiplus.dl_); my $aliendir = qq(Alien/wxWidgets/$alienkey); foreach ( @INC ) { if( -d qq($_/$aliendir) ) { my $sourcefile = qq($_/$sourcepart); my $targetfile = qq($_/$targetpart); next if(!-e $sourcefile); unlink($targetfile); next if $gdiplusnative; # put this here means reinstall after OS upgrade will remove data # install side by side DLL Win32::CopyFile($sourcefile, $targetfile, 1); my ($oldattribs, $newattribs); Win32::File::GetAttributes($targetfile, $oldattribs); $newattribs = $oldattribs | READONLY; Win32::File::SetAttributes($targetfile, $newattribs); # update the packlist for uninstall my $packlist = $ENV{PPM_INSTPACKLIST}; $targetfile =~ s/\\/\//g; next if(!-w $packlist); open my $fh, '>>', $packlist; print $fh qq($targetfile\n); close($fh); } } 1;