Perl-Dist-WiX

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

       (should have been in 1.200)
    4. Fixing small bugs in checkpointing.

1.200   Sat 01 May 2010
    1. Documentation cleanup (including adding when required).
    2. Supports 5.12.0 final. Removes 5.11.5 support.
    3. Used to build Strawberry Perl April 2010.
    4. Checkpointing works again.
    5. .tar.bz2 files are now usable as parameters to this module.
    6. (beta, untested) .tar.xz file support has also been added.
    7. A relocation custom action has been added.

1.102_102   Thu 25 Mar 2010
    1. Adding 5.12.0 support (based on 5.12.0-RC0 for now).
    2. Bug fixes to relocation support.
    3. Used to build Strawberry Perl April 2010 Beta 1
       (5.12.x versions).

1.102_101   Sat 20 Mar 2010
    1. Scripts now will go to perl/site/bin.
    2. perl 5.11.5 support is added.
    3. Relocation script written in perl has been added.
    4. Change $Config{installsitebin} from perl/bin to perl/site/bin,
       and add perl/site/bin to the path.
    5. Used to build Strawberry Perl April 2010 Beta 1

MANIFEST  view on Meta::CPAN

share/distroprefs/task-catalyst.yml
share/distroprefs/Task-Kensho-0.22.patch
share/distroprefs/task-kensho.yml
share/growl-icon.png
share/License.rtf
share/perldoc.ico
share/portable.perl
share/portable/portable.perl
share/portable/portableshell.bat
share/portable/README.portable.TXT
share/relocation.pl.bat
share/update_env.pl.bat
share/win32.ico
share/x64/ClearFolderCA.dll
src/ClearFolderCA/ClearFolderCA.sln
src/ClearFolderCA/ClearFolderCA/CheckForSpaces.cpp
src/ClearFolderCA/ClearFolderCA/ClearFolderCA.cpp
src/ClearFolderCA/ClearFolderCA/ClearFolderCA.def
src/ClearFolderCA/ClearFolderCA/ClearFolderCA.rc
src/ClearFolderCA/ClearFolderCA/ClearFolderCA.vcproj
src/ClearFolderCA/ClearFolderCA/ReadMe.txt

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

below.  They may often be set by subclasses.

All attributes below can also be called as accessors on the object created.

There are six types of parameters that can be passed to new().

=head3 Types of distributions to build

This specifies the "highest" level of change in how the perl distribution is 
made - whether a .zip is requested, a .msi, a "thumb-drive portable" .zip, or
a relocatable .msi or .zip.

=head4 msi

The optional boolean C<msi> param is used to indicate that a Windows
Installer distribution package (otherwise known as an msi file) should 
be created.

It defaults to true, unless L<portable()|/portable> is true.

=cut

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

=cut

has 'portable' => (
	is      => 'ro',
	isa     => Bool,
	default => 0,
);



=head4 relocatable

The optional C<relocatable> parameter is used to determine whether the 
distribution is meant to be relocatable.

This defaults to a false value. 

=cut

has 'relocatable' => (
	is      => 'ro',
	isa     => Bool,
	default => 0,
);



=head4 exe

The optional boolean C<exe> param is unused at the moment.

lib/Perl/Dist/WiX.pm  view on Meta::CPAN


		# Install additional Perl modules
		'install_cpan_upgrades',

		# Check for missing files.
		'verify_msi_file_contents',

		# Apply optional portability support
		'install_portable',

		# Apply optional relocation support
		'install_relocatable',

		# Remove waste and temporary files
		'remove_waste',

		# Regenerate file fragments
		'regenerate_fragments',

		# Find file ID's for relocation.
		'find_relocatable_fields',

		# Write out the merge module
		'write_merge_module',

		# Install the Win32 extras
		'install_win32_extras',

		# Create the distribution list
		'create_distribution_list',

lib/Perl/Dist/WiX.pm  view on Meta::CPAN


		# Install additional Perl modules
		'install_cpan_upgrades',

		# Check for missing files.
		'verify_msi_file_contents',

		# Apply optional portability support
		'install_portable',

		# Apply optional relocation support
		'install_relocatable',

		# Remove waste and temporary files
		'remove_waste',

		# Regenerate file fragments
		'regenerate_fragments',

		# Find file ID's for relocation.
		'find_relocatable_fields',

		# Write out the merge module
		'write_merge_module',

		# Install the Win32 extras
		'install_win32_extras',

		# Create the distribution list
		'create_distribution_list',

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

has 'msi_exit_text' => (
	is      => 'ro',
	isa     => Str,
	default => 'Before you start using Perl, please read the README file.',
);



=head4 msi_install_warning_text

Returns the text that the MSI needs to use when not able to relocate.

=cut

has 'msi_install_warning_text' => (
	is      => 'ro',
	isa     => Str,
	lazy    => 1,
	builder => '_build_msi_install_warning_text',
);

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

=cut

has 'smoketest' => (
	is      => 'ro',
	isa     => Bool,
	default => 0,
);



=head4 use_dll_relocation

The optional C<use_dll_relocation> parameter specifies whether to use the
C++ relocation dll that's being tested for relocating perl, or to call a 
Perl relocation script from the .msi's.

This parameter has no effect is the C<msi> parameter is false, or if the
C<relocatable> parameter is false.

If this variable is false, the Perl relocation script is used instead.
(The default is true.)

=cut

has 'use_dll_relocation' => (
	is      => 'ro',
	isa     => Bool,
	default => 1,
);



=head3 Directories, files, and URLs used in building.

These parameters specify which directories and files are used when building 
a distribution.

At a minimum, L<image_dir|/image_dir> is required, which specifies where Perl
will be installed (by default, in the case where L<relocatable|/relocatable>
is true.) All other options have defaults, most of the time.

=head4 binary_root

The optional C<binary_root> accessor is the URL (as a string, not including 
the filename) where the distribution will find its libraries to download.

Defaults to 'http://strawberryperl.com/package' unless C<offline> is set, 
in which case it defaults to C<download_dir()>.

lib/Perl/Dist/WiX.pm  view on Meta::CPAN


The I<required> C<image_dir> method specifies the location of the Perl install,
both on the author's and end-user's host.

Please note that this directory will be automatically deleted if it
already exists at object creation time. Trying to build a Perl
distribution on the SAME distribution can thus have devastating
results, and an attempt is made to prevent this from happening.

Perl::Dist::WiX distributions can only be installed to fixed paths
as of yet, unless C<relocatable()|/relocatable> is true.

To facilitate a correctly working CPAN setup, the files that will
ultimately end up in the installer must also be assembled under the
same (default, in the C<relocatable> case) path on the author's machine.

=cut

has 'image_dir' => (
	is       => 'ro',
	isa      => ExistingSubdirectory,
	coerce   => 1,
	required => 1,
);

lib/Perl/Dist/WiX.pm  view on Meta::CPAN


1) update the version of Perl installed using the merge module.

2) be installed on top of another distribution using that merge module (or 
an earlier version of it).

The next 5 options specify the information required to use a merge module.

=head4 fileid_perl

The optional C<fileid_perl> parameter helps the relocation find the perl 
executable.

If the merge module is being built, this is set by the 
L<install_relocatable|/install_relocatable> method.

If the merge module is being used, it needs to be passed in to new().

=head4 fileid_perl_h

TODO

=cut

has 'fileid_perl' => (

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

	writer  => '_set_fileid_perl',
	default => q{},
);

sub fileid_perl_h {
	my $self    = shift;
	my $perl_id = $self->fileid_perl();
	return q{[#} . $perl_id . q{]};
}

=head4 fileid_relocation_pl

The optional C<fileid_relocation_pl> parameter helps the relocation find 
the relocation script.

If the merge module is being built, this is set by the 
L<install_relocatable|/install_relocatable> method.

If the merge module is being used, it needs to be passed in to new().

=head4 fileid_relocation_pl_h

TODO

=cut

has 'fileid_relocation_pl' => (
	is      => 'ro',
	isa     => Str,
	writer  => '_set_fileid_relocation_pl',
	default => q{},
);

sub fileid_relocation_pl_h {
	my $self      = shift;
	my $script_id = $self->fileid_relocation_pl();
	return q{[#} . $script_id . q{]};
}


=head4 msm_code

The optional C<msm_code> parameter is used to specify the product code
for the merge module referred to in C<msm_to_use>.

C<msm_to_use>, C<msm_zip>, and this parameter must either be all unset, 

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

=cut

sub final_initialization {
	my $self = shift;

	# Check for architectures that we can't build 64-bit on.
	if ( 64 == $self->bits() ) {
		$self->_check_64_bit();
	}

	if (    $self->use_dll_relocation()
		and $self->relocatable()
		and not $self->can('msm_relocation_idlist') )
	{
		PDWiX::Parameter->throw(
			parameter => 'use_dll_relocation: Cannot use DLL relocation'
			  . ' without a relocation file id being available '
			  . '(set this parameter to 0)',
			where => '->final_initialization',
		);
	}

	# Redirect $ENV{TEMP} to within our build directory.
	$self->trace_line( 1,
		"Emptying the directory to redirect \$ENV{TEMP} to...\n" );
	$self->remake_path( $self->tempenv_dir() );
	## no critic (RequireLocalizedPunctuationVars)

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

			id           => 'DataFolder'
		) );

	$self->make_path( $self->dir('data') );

	return 1;
} ## end sub install_portable



=head3 install_relocatable

The C<install_relocatable> method is used by C<run> to install the perl
script to make Perl relocatable when installed.

This routine must be run before L</regenerate_fragments>, so that the 
fragment created in this method is regenerated and the file ID can
be found by L</find_relocatable_fields> later.

=cut

# Relocatability support must be added before writing the merge module
sub install_relocatable {
	my $self = shift;

	return 1 if not $self->relocatable();

	# Copy the relocation information in.
	$self->copy_file( catfile( $self->wix_dist_dir(), 'relocation.pl.bat' ),
		$self->image_dir() );

	# Make sure it gets installed.
	$self->insert_fragment(
		'relocation_script',
		File::List::Object->new()
		  ->add_file( $self->file('relocation.pl.bat') ),
	);

	return 1;
} ## end sub install_relocatable



=head3 find_relocatable_fields

The C<find_relocatable_fields> method is used by C<run> to find the 
property ID's required to make Perl relocatable when installed.

This routine must be run after L<regenerate_fragments()|/regenerate_fragments>.

=cut

# Relocatability support must be added before writing the merge module
sub find_relocatable_fields {
	my $self = shift;

	return 1 if $self->portable();

	# Set the fileid attributes.
	my $perl_id =
	  $self->get_fragment_object('perl')
	  ->find_file_id( $self->file(qw(perl bin perl.exe)) );
	if ( not $perl_id ) {
		PDWiX->throw("Could not find perl.exe's ID.\n");
	}
	$self->_set_fileid_perl($perl_id);
	$self->trace_line( 2, "File ID for perl.exe: $perl_id\n" );

	return 1 if not $self->relocatable();

	my $script_id =
	  $self->get_fragment_object('relocation_script')
	  ->find_file_id( $self->file('relocation.pl.bat') );
	if ( not $script_id ) {
		PDWiX->throw("Could not find relocation.pl.bat's ID.\n");
	}
	$self->_set_fileid_relocation_pl($script_id);
	$self->trace_line( 2, "File ID for relocation.pl.bat: $script_id\n" );

	return 1;
} ## end sub find_relocatable_fields



=head3 install_win32_extras

The C<install_win32_extras> method is used by L<run()|/run> to install 
the links and launchers into the Start menu.

=cut

lib/Perl/Dist/WiX.pm  view on Meta::CPAN


	# Add merge modules.
	foreach my $mm_key ( $self->_merge_module_keys() ) {
		$mm = $self->get_merge_module_object($mm_key);
		$self->feature_tree_object()->add_merge_module($mm);
	}

	# Write out the .wxs file
	my $content = $self->process_template(
		'Main.wxs.tt',
		fileid_relocation_pl_h => $self->fileid_relocation_pl_h(),
		fileid_perl_h          => $self->fileid_perl_h(),
		propertylist           => $self->_get_msi_property_list(),
	);
	$content =~ s{\r\n}{\n}msg;        # CRLF -> LF
	$filename_in =
	  catfile( $self->fragment_dir(), $self->app_name() . q{.wxs} );

	if ( -f $filename_in ) {

		# Had a collision. Yell and scream.

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

	}
	$list->add_simple_property( 'WIXUI_EXITDIALOGOPTIONALTEXT',
		$self->msi_exit_text() );
	if ( $self->msi_run_readme_txt() ) {
		$list->add_simple_property( 'WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT',
			'Read README file.' );
		$list->add_simple_property( 'WIXUI_EXITDIALOGOPTIONALCHECKBOX', 1 );
		$list->add_simple_property( 'WixShellExecTarget',
			$self->msi_fileid_readme_txt() );
	}
	if ( $self->relocatable() ) {
		$list->add_simple_property( 'WIXUI_INSTALLDIR', 'INSTALLDIR' );
	}
	if ( defined $self->msi_banner_top() ) {
		$list->add_wixvariable( 'WixUIBannerBmp', $self->msi_banner_top() );
	}
	if ( defined $self->msi_banner_side() ) {
		$list->add_wixvariable( 'WixUIDialogBmp',
			$self->msi_banner_side() );
	}
	$list->add_wixvariable( 'WixUILicenseRtf', $self->msi_license_file() );

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

		}

		push @files, $filename_out;
	} ## end foreach my $key ( $self->_fragment_keys...)

	# Generate feature tree.
	$self->_set_feature_tree_object(
		Perl::Dist::WiX::FeatureTree->new( parent => $self, ) );

	my $commandline = q{};
	if ( $self->relocatable() ) {
		$commandline = $self->msm_relocation_commandline();
	}

	# Write out the .wxs file
	my $content = $self->process_template(
		'Merge-Module.wxs.tt',
		fileid_relocation_pl_h     => $self->fileid_relocation_pl_h(),
		fileid_perl_h              => $self->fileid_perl_h(),
		msm_relocation_commandline => $commandline,
	);
	$content =~ s{\r\n}{\n}msg;        # CRLF -> LF
	$filename_in =
	  catfile( $self->fragment_dir, $self->app_name . q{.wxs} );

	if ( -f $filename_in ) {

		# Had a collision. Yell and scream.
		PDWiX->throw(
			"Could not write out $filename_in: File already exists.");

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

Returns the UI type that the MSI needs to use.

=cut

# For template
sub msi_ui_type {
	my $self = shift;

	if ( defined $self->msi_feature_tree() ) {
		return 'FeatureTree';
	} elsif ( $self->relocatable() ) {
		return 'MyInstallDir';
	} else {
		return 'MyInstall';
	}
}



=head3 msi_platform_string

lib/Perl/Dist/WiX.pm  view on Meta::CPAN

		# Shift the third portion over to match msi_perl_version.
		$ver[2] <<= 8;
		$ver[2] += 255;
	}

	return join q{.}, @ver;

} ## end sub msi_perl_major_version


=head3 msi_relocation_commandline

Returns a command line to use in Main.wxs.tt for relocation purposes.

=cut

# For template.
sub msi_relocation_commandline {
	my $self = shift;

	my $answer;
	my %files = $self->msi_relocation_commandline_files();

	my ( $fragment, $file, $id );
	while ( ( $fragment, $file ) = each %files ) {
		$id = $self->get_fragment_object($fragment)->find_file_id($file);
		if ( not defined $id ) {
			PDWiX->throw(
				"Could not find file $file in fragment $fragment\n");
		}
		$answer .= " --file [#$id]";
	}

	return $answer;
} ## end sub msi_relocation_commandline



=head3 msm_relocation_commandline

Returns a command line to use in Merge-Module.wxs.tt for relocation purposes.

=cut

# For template.
sub msm_relocation_commandline {
	my $self = shift;

	my $answer;
	my %files = $self->msm_relocation_commandline_files();

	my ( $fragment, $file, $id );
	while ( ( $fragment, $file ) = each %files ) {
		$id = $self->get_fragment_object($fragment)->find_file_id($file);
		if ( not defined $id ) {
			PDWiX->throw(
				"Could not find file $file in fragment $fragment\n");
		}
		$answer .= " --file [#$id]";
	}

	return $answer;
} ## end sub msm_relocation_commandline



=head3 msi_relocation_commandline_files

Returns the files to use in Main.wxs.tt for relocation purposes.

This is overridden in subclasses, and creates an exception if not overridden.

=cut

# For template.
sub msi_relocation_commandline_files {
	my $self = shift;

	PDWiX::Unimplemented->throw();

	return;
}



=head3 msm_relocation_commandline_files

Returns the files to use in Merge-Module.wxs.tt for relocation purposes.

This is overridden in subclasses, and creates an exception if not overridden.

=cut

# For template.
sub msm_relocation_commandline_files {
	my $self = shift;

	PDWiX::Unimplemented->throw();

	return;
}



=head3 msi_relocation_ca

Returns which CA to use in Main.wxs.tt and Merge-Module.wxs.tt for relocation 
purposes.

=cut

sub msi_relocation_ca {
	my $self = shift;

	return ( 64 == $self->bits() ) ? 'CAQuietExec64' : 'CAQuietExec';
}



=head3 msi_fileid_readme_txt 

Returns the ID of the tag that installs a README.txt file.

lib/Perl/Dist/WiX/Asset/Perl.pm  view on Meta::CPAN

				$self->_get_image_dir(), 'c',
				'bin',                   'libgcc_s_sjlj-1.dll'
			),
			catfile(
				$self->_get_image_dir(), 'perl',
				'bin',                   'libgcc_s_sjlj-1.dll'
			),
		);
	} ## end if ( 4 == $self->_gcc_version...)

	# Delete a2p.exe if relocatable (Can't relocate a binary).
	if ( $self->_relocatable() ) {
		unlink catfile( $self->_get_image_dir(), 'perl', 'bin', 'a2p.exe' )
		  or PDWiX->throw("Could not delete a2p.exe\n");
	}

	# Create the perl_licenses fragment.
	my $fl_lic = File::List::Object->new()
	  ->readdir( catdir( $self->_get_image_dir(), 'licenses', 'perl' ) );
	$self->_insert_fragment( 'perl_licenses', $fl_lic );

	# Now create the perl fragment.

lib/Perl/Dist/WiX/Mixin/Support.pm  view on Meta::CPAN

				message => "Failed to remove directory, errors:\n$errors"
			);
		} ## end if ( @{$err} )
	} ## end if ( -d "$dir" )

	return;
} ## end sub remove_path



=head2 make_relocation_file

	$dist->make_relocation_file('strawberry_merge_module.reloc.txt');
	
	$dist->make_relocation_file('strawberry_ui.reloc.txt', 
		'strawberry_merge_module.reloc.txt');
	
Creates a file to be input to relocation.pl.

The first file is created, and it includes all files in the .source file 
that actually exist, and adds all .packlist files that are not already
being processed for relocation in files after the first.

If there is no second parameter, the first file will include all
.packlist files existing to that point.

=cut 

sub make_relocation_file {
	my $self                      = shift;
	my $file                      = shift;
	my (@files_already_processed) = @_;

	## no critic(ProhibitComplexMappings ProhibitMutatingListFunctions)
	## no critic(ProhibitCaptureWithoutTest RequireBriefOpen)
	# TODO: Calm down on the no critics.

	# Get the input and output filenames.
	my $file_in  = $self->patch_pathlist()->find_file( $file . '.source' );
	my $file_out = $self->image_dir()->file($file);

	# Find files we're already assigned for relocation.
	my @filelist;
	my %files_already_relocating;
	foreach my $file_already_processed (@files_already_processed) {
		@filelist = read_file(
			$self->image_dir()->file($file_already_processed)->stringify()
		);
		shift @filelist;
		%files_already_relocating = (
			%files_already_relocating,
			map { m/\A([^:]*):.*\z/msx; $1 => 1 } @filelist
		);
	}

	# Find all the .packlist files.
	my @packlists_list =
	  File::Find::Rule->file()->name('.packlist')->relative()
	  ->in( $self->image_dir()->stringify() );
	my %packlists = map { s{/}{\\}msg; $_ => 1 } @packlists_list;

	# Find all the .bat files.
	my @batch_files_list =
	  File::Find::Rule->file()->name('*.bat')->relative()
	  ->in( $self->image_dir()->stringify() );
	my %batch_files = map { s{/}{\\}msg; $_ => 1 } @batch_files_list;

	# Get rid of the .packlist and *.bat files we're already relocating.
	delete @packlists{ keys %files_already_relocating };
	delete @batch_files{ keys %files_already_relocating };

	# Print the first line of the relocation file.
	my $file_out_handle;
	open $file_out_handle, '>', $file_out
	  or PDWiX::File->throw(
		file    => $file_out,
		message => 'Could not open.'
	  );
	print {$file_out_handle} $self->image_dir()->stringify();
	print {$file_out_handle} "\\\n";

	# Read the source file, writing out the files that actually exist.

lib/Perl/Dist/WiX/Mixin/Support.pm  view on Meta::CPAN

		if ( defined $1 and -f $self->image_dir()->file($1)->stringify() ) {
			print {$file_out_handle} $filelist_entry;
		}
	}

	# Print out the rest of the .packlist files.
	foreach my $pl ( sort { $a cmp $b } keys %packlists ) {
		print {$file_out_handle} "$pl:backslash\n";
	}

	# Print out the batch files that need relocated.
	my $batch_contents;
	my $match_string =
	  q(eval [ ] 'exec [ ] )
	  . quotemeta $self->image_dir()->file('perl\\bin\\perl.exe')
	  ->stringify();
	foreach my $batch_file ( sort { $a cmp $b } keys %batch_files ) {
		$self->trace_line( 5,
			"Checking to see if $batch_file needs relocated.\n" );
		$batch_contents =
		  read_file( $self->image_dir()->file($batch_file)->stringify() );
		if ( $batch_contents =~ m/$match_string/msgx ) {
			print {$file_out_handle} "$batch_file:backslash\n";
		}
	}

	# Finish up by closing the handle.
	close $file_out_handle or PDWiX->throw('Ouch!');

	return 1;
} ## end sub make_relocation_file

no Moose;
__PACKAGE__->meta()->make_immutable();

1;

__END__

=pod

lib/Perl/Dist/WiX/Role/Asset.pm  view on Meta::CPAN

		'_extract'          => 'extract_archive',
		'_extract_filemap'  => '_extract_filemap',
		'_insert_fragment'  => 'insert_fragment',
		'_patch_file'       => 'patch_file',
		'_patch_perl_file'  => 'patch_perl_file',
		'_pushd'            => 'push_dir',
		'_perl'             => 'execute_perl',
		'_build'            => 'execute_build',
		'_make'             => 'execute_make',
		'_gcc_version'      => 'gcc_version',
		'_relocatable'      => 'relocatable',
		'_force'            => 'force',
		'_forceperl'        => 'forceperl',
		'_use_sqlite'       => '_use_sqlite',
		'_add_to_distributions_installed' =>
		  '_add_to_distributions_installed',
	},
	required => 1,
);


lib/Perl/Dist/WiX/Util/Machine.pm  view on Meta::CPAN

	$machine->add_dimension('version');
	$machine->add_option('version',
		perl_version => '5101',
	);
	$machine->add_option('version',
		perl_version => '5101',
		portable     => 1,
	);
	$machine->add_option('version',
		perl_version => '5121',
		relocatable  => 1,
	);

	# Set the different paths
	$machine->add_dimension('drive');
	$machine->add_option('drive',
		image_dir => 'C:\strawberry',
	);
	$machine->add_option('drive',
		image_dir => 'D:\strawberry',
		msi       => 1,
		zip       => 0,
	);

	$machine->run();
	# Creates 8 distributions (really 6, because you can't have
	# portable => 1 and zip => 0 for the same distribution,
	# nor do we need to build a relocatable version twice.)	

=head1 DESCRIPTION

Perl::Dist::WiX::Util::Machine is a Perl::Dist::WiX multiplexer.

It provides the functionality required to generate several
variations of a distribution at the same time.

=cut

lib/Perl/Dist/WiX/Util/Machine.pm  view on Meta::CPAN

	$self->_set_options( $name => [] );
	return 1;
} ## end sub add_dimension



=head2 add_option

  $machine->add_option('perl_version',
    perl_version => '5120',
    relocatable => 1,
  );

Adds a 'option' (a set of parameters that can change) to a dimension. 

The first parameter is the dimension to add the option to, and the 
other parameters are stored in the dimension to be used when creating
objects.

The combination of the C<'common'> parameters and one option from each
dimension is used when creating or iterating through distribution objects.

share-5123/default/win32/config.gc.tt  view on Meta::CPAN

uselongdouble='undef'
usemallocwrap='define'
usemorebits='undef'
usemultiplicity='undef'
usemymalloc='n'
usenm='false'
useopcode='true'
useperlio='undef'
useposix='true'
usereentrant='undef'
userelocatableinc='undef'
usesfio='false'
useshrplib='true'
usesitecustomize='undef'
usesocks='undef'
usethreads='undef'
usevendorprefix='define'
usevfork='false'
usrinc='/usr/include'
uuname=''
uvXUformat='"lX"'

share-5123/default/win32/config.gc64nox.tt  view on Meta::CPAN

uselongdouble='undef'
usemallocwrap='define'
usemorebits='undef'
usemultiplicity='undef'
usemymalloc='n'
usenm='false'
useopcode='true'
useperlio='undef'
useposix='true'
usereentrant='undef'
userelocatableinc='undef'
usesfio='false'
useshrplib='true'
usesitecustomize='undef'
usesocks='undef'
usethreads='undef'
usevendorprefix='define'
usevfork='false'
usrinc='/usr/include'
uuname=''
uvXUformat='"I64X"'

share-5123/default/win32/config_H.gc  view on Meta::CPAN


/* BIN:
 *	This symbol holds the path of the bin directory where the package will
 *	be installed. Program must be prepared to deal with ~name substitution.
 */
/* BIN_EXP:
 *	This symbol is the filename expanded version of the BIN symbol, for
 *	programs that do not want to deal with that at run-time.
 */
/* PERL_RELOCATABLE_INC:
 *	This symbol, if defined, indicates that we'd like to relocate entries
 *	in @INC at run time based on the location of the perl binary.
 */
#define BIN "c:\\perl\\bin"	/**/
#define BIN_EXP "c:\\perl\\bin"	/**/
#define PERL_RELOCATABLE_INC "undef" 		/**/

/* CAT2:
 *	This macro concatenates 2 tokens together.
 */
/* STRINGIFY:

share-5123/default/win32/config_H.gc64nox  view on Meta::CPAN


/* BIN:
 *	This symbol holds the path of the bin directory where the package will
 *	be installed. Program must be prepared to deal with ~name substitution.
 */
/* BIN_EXP:
 *	This symbol is the filename expanded version of the BIN symbol, for
 *	programs that do not want to deal with that at run-time.
 */
/* PERL_RELOCATABLE_INC:
 *	This symbol, if defined, indicates that we'd like to relocate entries
 *	in @INC at run time based on the location of the perl binary.
 */
#define BIN "c:\\perl\\bin"	/**/
#define BIN_EXP "c:\\perl\\bin"	/**/
#define PERL_RELOCATABLE_INC "undef" 		/**/

/* CAT2:
 *	This macro concatenates 2 tokens together.
 */
/* STRINGIFY:

share/default/Main.wxs.tt  view on Meta::CPAN

    </Condition>
    
    <Condition Message='Cannot install on Windows NT 4.0 or Windows 2000 systems.'>
      <![CDATA[VersionNT > 500]]>
    </Condition>

	<UIRef Id='WixUI_[% dist.msi_ui_type %]' />
    <UIRef Id='WixUI_ErrorProgressText' />
    <UIRef Id='WixUI_Common' />

[% IF dist.relocatable %]
	<Property Id="UPGRADEDIR">
		<RegistrySearch Id="InstallDir" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]" Name="InstallLocation" Type="raw" />
	</Property>
[% END %]

    <Property Id='INSTALLDIR' Value='[% dist.image_dir.stringify %]' />

[% directory_tree %]

[% dist.feature_tree_object.as_string %]

share/default/Main.wxs.tt  view on Meta::CPAN

  [%- IF 64 == dist.bits -%]
    <Binary Id='B_ClearFolder' SourceFile='[% dist.wix_dist_dir %]\x64\ClearFolderCA.dll' />
  [%- ELSE -%]
    <Binary Id='B_ClearFolder' SourceFile='[% dist.wix_dist_dir %]\ClearFolderCA.dll' />
  [%- END -%]
[%- END %]
    <UI>
   	  <ProgressText Action="CA_ClearSiteFolder">Preparing the site folder for cleaning... (please wait a while)</ProgressText>
    </UI>

[% IF dist.relocatable %]
	<Property Id="NO_RELOCATE" Secure="yes"/>
	<Property Id="NO_RELOCATE.[% dist.msm_package_id_property %]" Secure="yes"/>
	<CustomAction Id="CA_SetARPInstallLoc" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]"  Execute="immediate"/>
	<CustomAction Id="CA_GetARPInstallLoc" Property="INSTALLDIR" Value="[UPGRADEDIR]"  Execute="immediate"/>
	<InstallUISequence>
		<Custom Action="CA_GetARPInstallLoc" Before="CostInitialize">
			OLDERVERSIONBEINGUPGRADED AND UPGRADEDIR
		</Custom>
	</InstallUISequence>
	
	[% IF dist.use_dll_relocation %]
	<CustomAction Id="CA_Location_Perl" Property="P_Perl_Location"
				  Value="&quot;[#[% dist.fileid_perl %].[% dist.msm_package_id_property %]]&quot;" Execute="immediate"/>
	<CustomAction Id="CA_NoRelocate" Property="NO_RELOCATE.[% dist.msm_package_id_property %]"
				  Value="[NO_RELOCATE]" Execute="immediate"/>
	<CustomAction Id="CA_FileList" Property="CA_Relocate"
				  Value="MSI;[INSTALLDIR];[% dist.msi_relocation_idlist %]" Return="check" />
	<CustomAction Id="CA_Relocate" BinaryKey="B_ClearFolder" DllEntry="Relocate" Return="check" Execute="deferred" />

	<InstallExecuteSequence>
		<Custom Action="CA_SetARPInstallLoc" Before="RegisterProduct" />
		<Custom Action="CA_Location_Perl" After="CostFinalize"/>
		<Custom Action="CA_NoRelocate" After="CA_Location_Perl"/>
		<Custom Action="CA_FileList" After="InstallFiles"/>	
		<Custom Action="CA_Relocate" After="CA_FileList">
			<![CDATA[NOT (NO_RELOCATE OR Installed)]]>
		</Custom>
	</InstallExecuteSequence>
	<Property Id="RELOCFILE" Secure="yes"/>
	<Property Id="RELOCFILE.[% dist.msm_package_id_property %]" Secure="yes"/>
	[% ELSE %]
	<CustomAction Id="CA_Location_Perl" Property="P_Perl_Location"
				  Value="&quot;[#[% dist.fileid_perl %].[% dist.msm_package_id_property %]]&quot;" Execute="immediate"/>
	<CustomAction Id="CA_Rlc_2" Property="P_Rlc_2"
				  Value="[#[% fileid_relocation_pl_h %].[% dist.msm_package_id_property %]]" Execute="immediate"/>
	<CustomAction Id="CA_Rlc_3" Property="P_Rlc_3"
				  Value="[P_Location_Perl] [P_Rlc_2] --location [INSTALLDIR] --quiet" Execute="immediate"/>
	<CustomAction Id="CA_Rlc_4" Property="P_Rlc_4"
				  Value="[% dist.msi_relocation_commandline %]" Execute="immediate"/>
	<CustomAction Id="CA_NoRelocate" Property="NO_RELOCATE.[% dist.msm_package_id_property %]"
 				  Value="[NO_RELOCATE]" Execute="immediate"/>
	<CustomAction Id="CA_Relocate_Cmd" Property="CA_Relocate"
				  Value="[P_Rlc_3][P_Rlc_4]" Execute="immediate"/>
	<CustomAction Id="CA_Relocate" BinaryKey="WixCA" DllEntry="[% dist.msi_relocation_ca %]"
				  Execute="deferred" Return="check" Impersonate="no" />

	<InstallExecuteSequence>
 		<Custom Action="CA_SetARPInstallLoc" Before="RegisterProduct" />
		<Custom Action="CA_Location_Perl" After="CostFinalize"/>
		<Custom Action="CA_Rlc_2" After="CA_Location_Perl"/>
		<Custom Action="CA_Rlc_3" After="CA_Rlc_2"/>
		<Custom Action="CA_Rlc_4" After="CA_Rlc_3"/>
		<Custom Action="CA_NoRelocate" After="CA_Rlc_4"/>		
		<Custom Action="CA_Relocate_Cmd" After="CA_NoRelocate"/>

share/default/Merge-Module.documentation.html.tt  view on Meta::CPAN

<head>
<title>Merge Module Documentation</title>
</head>
<body>
<p>To use this merge module, your Perl::Dist::WiX subclass has to use these parameters to new():</p>

<pre style="margin-left: 0.25in;">...
msm_to_use           => '<i>&lt;URL location of [% dist.output_base_filename %].msm&gt;</i>',
msm_zip              => '<i>&lt;URL location of [% dist.output_base_filename %].zip&gt;</i>',
msm_code             => '[% dist.msm_package_id %]',
[% IF dist.relocatable %]
fileid_perl          => '[% dist.fileid_perl %]',
fileid_relocation_pl => '[% dist.fileid_relocation_pl %]',
[% END %]...</pre>

<p>In addition, your 'tasklist' parameter has to use 'initialize_using_msm' as its second entry (right after 'final_initialization'.)</p>

</body>
</html>

share/default/Merge-Module.wxs.tt  view on Meta::CPAN

  [% IF 64 == dist.bits %]
    <Binary Id='B_ClearFolder' SourceFile='[% dist.wix_dist_dir %]\x64\ClearFolderCA.dll' />
  [% ELSE %]
    <Binary Id='B_ClearFolder' SourceFile='[% dist.wix_dist_dir %]\ClearFolderCA.dll' />
  [% END %]
[% END %]
    <UI>
   	  <ProgressText Action="CA_ClearFolder">Scanning for added files to delete... (please wait a while)</ProgressText>
    </UI>

[% IF dist.relocatable %]
	[% IF dist.use_dll_relocation %]
	<CustomAction Id="CA_FileList_msm" Property="CA_Relocate_msm"
				  Value="MM;[INSTALLDIR];[% dist.msm_relocation_idlist %]" Return="check" />
	<CustomAction Id="CA_Relocate_msm" BinaryKey="B_ClearFolder" 
				  DllEntry="RelocateMM" Execute="deferred" Return="check" />

	<InstallExecuteSequence>
		<Custom Action="CA_FileList_msm" After="InstallFiles" />
		<Custom Action="CA_Relocate_msm" After="CA_FileList_msm">
			<![CDATA[NOT (NO_RELOCATE OR Installed)]]>
		</Custom>
	</InstallExecuteSequence>
	[% ELSE %]
	<CustomAction Id="CA_Rlm_1" Property="P_Rlm_1"
				  Value="&quot;[% fileid_perl_h %]&quot;" Execute="immediate"/>
	<CustomAction Id="CA_Rlm_2" Property="P_Rlm_2"
				  Value="[% fileid_relocation_pl_h %]" Execute="immediate"/>
	<CustomAction Id="CA_Rlm_3" Property="P_Rlm_3"
				  Value="[P_Rlm_1] [P_Rlm_2]" Execute="immediate"/>
	<CustomAction Id="CA_Rlm_4" Property="P_Rlm_4"
				  Value="--location [INSTALLDIR] --quiet" Execute="immediate"/>
	<CustomAction Id="CA_Rlm_5" Property="P_Rlm_5"
				  Value="[P_Rlm_3] [P_Rlm_4]" Execute="immediate"/>
	<CustomAction Id="CA_Rlm_6" Property="P_Rlm_6"
				  Value="[% msm_relocation_commandline %]" Execute="immediate"/>
	<CustomAction Id="CA_Relocate_msm_Cmd" Property="CA_Relocate_msm"
				  Value="[P_Rlm_5][P_Rlm_6]" Execute="immediate"/>
	<CustomAction Id="CA_Relocate_msm" BinaryKey="WixCA" DllEntry="[% dist.msi_relocation_ca %]"
				  Execute="deferred" Return="check" Impersonate="no"/>
 	<InstallExecuteSequence>
		<Custom Action="CA_Rlm_1" After="CostFinalize"/>
		<Custom Action="CA_Rlm_2" After="CA_Rlm_1"/>
		<Custom Action="CA_Rlm_3" After="CA_Rlm_2"/>
		<Custom Action="CA_Rlm_4" After="CA_Rlm_3"/>
		<Custom Action="CA_Rlm_5" After="CA_Rlm_4"/>
		<Custom Action="CA_Rlm_6" After="CA_Rlm_5"/>
		<Custom Action="CA_Relocate_msm_Cmd" After="CA_Rlm_6"/>
 		<Custom Action="CA_Relocate_msm" After="PublishProduct">

share/relocation.pl.bat  view on Meta::CPAN

use Getopt::Long qw(GetOptions);
use Pod::Usage qw(pod2usage);
use English qw( -no_match_vars );
use File::Spec::Functions qw(splitpath catfile);
use Carp qw(carp);
use Win32::File::Object qw();
use FindBin;

sub usage;
sub version;
sub relocate_file;

our $STRING_VERSION = our $VERSION = '1.002';
$VERSION  =~ s/_//;

my @files;
my $quiet = 0;
my $new_location = undef;

GetOptions('help|?'     => sub { pod2usage(-exitstatus => 0, -verbose => 0); }, 
		   'man'        => sub { pod2usage(-exitstatus => 0, -verbose => 2); },

share/relocation.pl.bat  view on Meta::CPAN

foreach my $file (@files) {
	@lines = read_file($file);
	my $old_location = shift @lines;
	chomp $old_location;
	
	print "\nRelocating files from $old_location to $new_location\n" if not $quiet;
	
  LINE:
	foreach my $line (@lines) {
		next LINE if $line eq "\n";
		$ok = relocate_file($old_location, $new_location, $quiet, split /:/, $line);
		if (not $ok) {
			carp "Could not relocate $file.\n" if not $quiet;
			exit(1);
		}
	}
	unshift @lines, "$new_location\n";
	write_file($file, @lines); 
}

print "Relocation completed\n" if not $quiet;
exit(0);

share/relocation.pl.bat  view on Meta::CPAN

	my ($old_location, $new_location) = @_;

	$old_location =~ s{\\}{/}gmx;
	$new_location =~ s{\\}{/}gmx;

	return ("file:///$old_location", "file:///$new_location");
}



sub relocate_file {
	my ($old_location, $new_location, $quiet, $file, $type) = @_;
	
	chomp $type;
	print "Relocating file $file using $type relocation\n" if not $quiet;

	my $full_file = catfile($new_location, $file);
	
	my $contents = read_file($full_file);

	my ($old, $new) = 
		('backslash'       eq $type) ? get_replacements_backslash($old_location, $new_location)
	  : ('slash'           eq $type) ? get_replacements_slash($old_location, $new_location)
	  : ('doublebackslash' eq $type) ? get_replacements_doublebackslash($old_location, $new_location)
	  : ('url'             eq $type) ? get_replacements_url($old_location, $new_location)
	  : ();

	if (defined $old) {
		$contents =~ s{$old}{$new}g;
	} else {
		carp "Can't do a $type relocation\n" if not $quiet;
		exit(1);
	}

	if ( not -f $full_file ) {
		carp "Can't relocate a file $file that isn't a file\n" if not $quiet;
		exit(1);
	}
	
	my $ok;
	if ( not -w $full_file ) {
		# Make sure it isn't readonly
		my $fileobj = Win32::File::Object->new( $full_file, 1 );
		my $readonly = $fileobj->readonly();
		$fileobj->readonly(0);
	

share/relocation.pl.bat  view on Meta::CPAN

	
	return $ok;
}



sub version {
	my (undef, undef, $script) = splitpath( $PROGRAM_NAME );

	print <<"EOF";
This is $script, version $STRING_VERSION, which relocates
Strawberry Perl to a new location.

Copyright 2010 Curtis Jewell.

This script may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the Perl 5 
distribution or the distribution containing this script.
EOF

	return;

share/relocation.pl.bat  view on Meta::CPAN




sub usage {
	my $error = shift;

	print "Error: $error\n\n" if (defined $error);
	my (undef, undef, $script) = splitpath( $PROGRAM_NAME );

	print <<"EOF";
This is $script, version $STRING_VERSION, which relocates
Strawberry Perl to a new location.

Usage: perl $script 
    [ --help ] [ --usage ] [ --man ] [ --version ] [ -? ]
    [--file relocationfile] [--location path] [--quiet]

For more assistance, run perl $script --help.
EOF

	exit(1);	
}

__END__

=head1 NAME

relocation.pl.bat - Relocates Strawberry Perl.

=head1 VERSION

This document describes relocation.pl.bat version 1.002.

=head1 DESCRIPTION

This script updates all of Strawberry Perl's files to a new location.

=head1 SYNOPSIS

  relocation.pl.bat [ --help ] [ --usage ] [ --man ] [ --version ] [ -?] 
                    [--file relocationfile] [--location path] [--quiet]

  Options:
    --usage         Gives a minimum amount of aid and comfort.
    --help          Gives aid and comfort.
    -?              Gives aid and comfort.
    --man           Gives maximum aid and comfort.
	
    --version       Gives the name, version and copyright of the script.

    --file          Gives the location of the file of hints to use to 
                    relocate Perl. Defaults to all *.reloc.txt files in
                    the current directory.
    --location      The location to relocate to. Defaults to $FindBin::Bin.
    --quiet         Print nothing.
	
=head1 DEPENDENCIES

Perl 5.8.9 is the mimimum version of perl that this script will run on.

Other modules that this script depends on are 
L<Getopt::Long|Getopt::Long>, L<Pod::Usage|Pod::Usage>, 
L<File::Slurp|File::Slurp>, and L<Win32::File::Object|Win32::File::Object>

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

	case IDCANCEL:
		return ERROR_INSTALL_USEREXIT;
	default:
		return ERROR_INSTALL_FAILURE;
	}
}


UINT _stdcall Relocate_File(
	MSIHANDLE hModule,
	const TCHAR *sDirectoryFrom, // Directory to relocate from
	const TCHAR *sDirectoryTo,   // Directory to relocate to
	const TCHAR *sFile,          // File to relocate
	const TCHAR *sType)          // Type of relocation to do.
{
	UINT uiAnswer = ERROR_SUCCESS;
	TCHAR sFileIn[_MAX_PATH];
	TCHAR sFileOut[_MAX_PATH];
	_tcscpy_s(sFileIn, _MAX_PATH, sDirectoryTo);
	_tcscat_s(sFileIn, _MAX_PATH, sFile);
	_tcscpy_s(sFileOut, _MAX_PATH, sFileIn);
	_tcscat_s(sFileOut, _MAX_PATH, _T(".new"));

	TCHAR sStringIn[_MAX_PATH];
	TCHAR sStringOut[_MAX_PATH];

	// Log the fact that we're relocating a file.
	StartLogStringR(_T("Relocating "));
	AppendLogStringR(sFile);
	AppendLogStringR(_T(" using relocation type "));
	AppendLogStringR(sType);
	uiAnswer = LogStringR(hModule);
	MSI_OK(uiAnswer)

	// Get the strings to look for.
	Relocate_GetSearchString(sStringIn,  sDirectoryFrom, sType);
	Relocate_GetSearchString(sStringOut, sDirectoryTo,   sType);

	if (0 == _tcscmp(sStringIn, _T(""))) {
		return ERROR_INSTALL_FAILURE;

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

	eAnswer = _tfopen_s(&fFileIn, sFileIn, _T("rtS"));
	if (eAnswer != 0) {
		return ERROR_INSTALL_FAILURE;
	}
	eAnswer = _tfopen_s(&fFileOut, sFileOut, _T("wt"));
	if (eAnswer != 0) {
		fclose(fFileIn);
		return ERROR_INSTALL_FAILURE;
	}

	// Set up our variables for the relocation.
	TCHAR  sLine[32767];
	TCHAR  sWork1[32767];
	TCHAR  sWork2[32767];
	TCHAR *sLoc   = NULL;
	size_t iStringInLength = _tcslen(sStringIn);
	size_t iStringOutLength = _tcslen(sStringOut);
	int iErrorFlag = 0;
	long lLine = 0;
	// Do the relocation.
	while (!feof(fFileIn)) {

		// Deal with errors. 
		if( _fgetts( sLine, 32766, fFileIn ) == NULL) {
			if (iErrorFlag) {
				fclose(fFileIn);
				fclose(fFileOut);
				::DeleteFile(sFileOut);
				uiAnswer = ERROR_INSTALL_FAILURE;
				break;

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

	}

	return uiAnswer;
}


UINT __stdcall Relocate_Worker(
	MSIHANDLE hModule,				// Handle of MSI being installed. [in]
									// Passed to most other routines.
	const TCHAR *sInstallDirectory,	// Directory being installed into.
	const TCHAR *sRelocationFile)	// File to use to relocate.
{
	UINT uiAnswer;
	FILE *fRelocationFileIn;
	FILE *fRelocationFileOut;
	TCHAR sLine[_MAX_PATH + 12];
	TCHAR sFileFrom[_MAX_PATH + 1];
	TCHAR sFileTo[_MAX_PATH + 1];
	TCHAR sDirectoryFrom[_MAX_PATH + 1];
	TCHAR sDirectoryTo[_MAX_PATH + 1];

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

	AppendLogStringR(sInstallDirectory);
	uiAnswer = LogStringR(hModule);
	MSI_OK(uiAnswer)

	// Open our files.
	errno_t eAnswer = 0;
	eAnswer = _tfopen_s(&fRelocationFileIn, sFileFrom, _T("rtS"));
	if (eAnswer != 0) 
		return ERROR_INSTALL_FAILURE;

	// First line of relocation file has where to relocate from.
	if( _fgetts( sDirectoryFrom, _MAX_PATH + 1, fRelocationFileIn ) == NULL) {
		fclose(fRelocationFileIn);
		return ERROR_INSTALL_FAILURE;
	}

	// Take off the line ending.
	*(sDirectoryFrom + _tcslen(sDirectoryFrom) - 1) = _T('\0');

	// Second parameter is where to relocate to.
	_tcscpy_s(sDirectoryTo, _MAX_PATH, sInstallDirectory);

	// Make sire it ends in a slash.
	if (*(sDirectoryTo + _tcslen(sDirectoryTo) - 1) != _T('\\')) {
		_tcscat_s(sDirectoryTo, _MAX_PATH, _T("\\"));
	}

	// We don't need to relocate if the directories are identical, right? right.
	// It's not an error, however.
	if (0 == _tcscmp(sDirectoryFrom, sDirectoryTo)) {
		fclose(fRelocationFileIn);
		return ERROR_SUCCESS;
	}

	// Open up the file to write relocating to.
	eAnswer = _tfopen_s(&fRelocationFileOut, sFileTo, _T("wt"));
	if (eAnswer != 0) {
		fclose(fRelocationFileIn);
		return ERROR_INSTALL_FAILURE;
	}

	// Log what we're doing.
	StartLogStringR(_T("Relocating from "));
	AppendLogStringR(sDirectoryFrom);
	uiAnswer = LogStringR(hModule);
	MSI_OK(uiAnswer)

	// Put where to relocate to in the file.
	_fputts(sDirectoryTo, fRelocationFileOut);
	_fputts(_T("\n"), fRelocationFileOut);

	int iErrorFlag = 0;
	// Go into the relocation loop.
	while (!feof(fRelocationFileIn)) {

		// Deal with errors. 
		if( _fgetts( sLine, _MAX_PATH + 11, fRelocationFileIn ) == NULL) {
			if (iErrorFlag) {
				uiAnswer = ERROR_INSTALL_FAILURE;
				break;
			}
			iErrorFlag++;
			continue;

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

		TCHAR  sFileToRelocate[_MAX_PATH + 1];
		TCHAR  sRelocationType[17];
		TCHAR *sTokenContext = NULL;
		TCHAR *sToken = NULL;

		sToken = _tcstok_s(sLine, _T(":"), &sTokenContext);
		_tcscpy_s(sFileToRelocate, _MAX_PATH, sToken);
		sToken = _tcstok_s(NULL, _T("\n"), &sTokenContext);
		_tcscpy_s(sRelocationType, 16, sToken);

		// Actually relocate the file.
		uiAnswer = Relocate_File(hModule, sDirectoryFrom, sDirectoryTo, sFileToRelocate, sRelocationType);
		if (uiAnswer != ERROR_SUCCESS) {
			break;
		}
	}

	fflush(fRelocationFileOut);
	fclose(fRelocationFileIn);
	fclose(fRelocationFileOut);

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

UINT __stdcall RelocateMM(
	MSIHANDLE hModule) // Handle of MSI being installed. [in]
	                   // Passed to most other routines.
{
	TCHAR sInstallDirectory[MAX_PATH + 1];
	TCHAR sRelocationFile[MAX_PATH + 1];
	TCHAR sCAData[MAX_PATH * 2 + 6];
	UINT uiAnswer;
	DWORD dwPropLength;

	// Get directory to relocate to.
	dwPropLength = MAX_PATH * 2 + 5; 
	uiAnswer = ::MsiGetProperty(hModule, TEXT("CustomActionData"), sCAData, &dwPropLength); 
	MSI_OK(uiAnswer)

	TCHAR *sTokenContext = NULL;
	TCHAR *sToken = NULL;

	sToken = _tcstok_s(sCAData, _T(";"), &sTokenContext);
	if (0 != _tcscmp(sToken, _T("MM"))) {
		return ERROR_INSTALL_FAILURE;

src/ClearFolderCA/ClearFolderCA/Relocate.cpp  view on Meta::CPAN

UINT __stdcall Relocate(
	MSIHANDLE hModule) // Handle of MSI being installed. [in]
	                   // Passed to most other routines.
{
	TCHAR sInstallDirectory[MAX_PATH + 1];
	TCHAR sRelocationFile[MAX_PATH + 1];
	TCHAR sCAData[MAX_PATH * 2 + 7];
	UINT uiAnswer;
	DWORD dwPropLength;

	// Get directory to relocate to.
	dwPropLength = MAX_PATH * 2 + 6; 
	uiAnswer = ::MsiGetProperty(hModule, TEXT("CustomActionData"), sCAData, &dwPropLength); 
	MSI_OK(uiAnswer)

	TCHAR *sTokenContext = NULL;
	TCHAR *sToken = NULL;

	sToken = _tcstok_s(sCAData, _T(";"), &sTokenContext);
	if (0 != _tcscmp(sToken, _T("MSI"))) {
		return ERROR_INSTALL_FAILURE;



( run in 0.636 second using v1.01-cache-2.11-cpan-71847e10f99 )