Skip to content

Commit

Permalink
(GH-1292) Ensure manifest extracted on unpackself
Browse files Browse the repository at this point in the history
If the `choco.exe.manifest` file is not present on first use of
choco.exe, it extracts the file. However Windows will have already
cached that choco.exe doesn't have a manifest and will not recheck
until the choco.exe changes (last modified time) as it caches that it
doesn't have a manifest. To force a recheck, someone would need to
"touch" the file to change the last modified date.

The issue comes down to the fact that a manifest file needs to be in
place when choco is installed, before the first time that `choco.exe`
gets called. Ensure that the manifest file is packaged up and it will
be unpacked automatically next to choco at the right time.
  • Loading branch information
ferventcoder committed May 29, 2017
1 parent 0b0f3c8 commit 75346e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .build.custom/nugetPrepare.post.step
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<exec program="${app.choco}"
workingdir="${dirs.drop.nuget}${path.separator}chocolatey${path.separator}tools${path.separator}chocolateyInstall"
commandline="${args.choco}" if="${platform::is-windows()}" />
<delete file="${dirs.drop.nuget}${path.separator}chocolatey${path.separator}tools${path.separator}chocolateyInstall${path.separator}tools${path.separator}detector.zip" failonerror="false" />
</target>

<target name="copy_legal">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ public virtual void noop(ChocolateyConfiguration configuration)
public virtual void run(ChocolateyConfiguration configuration)
{
this.Log().Info("{0} is unpacking required files for use. Overwriting? {1}".format_with(ApplicationParameters.Name, configuration.Force));
//refactor - thank goodness this is temporary, cuz manifest resource streams are dumb
// refactor - thank goodness this is temporary, cuz manifest resource streams are dumb

// unpack the manifest file as well
AssemblyFileExtractor.extract_all_resources_to_relative_directory(_fileSystem, Assembly.GetAssembly(typeof(ChocolateyUnpackSelfCommand)), _fileSystem.get_directory_name(_fileSystem.get_current_assembly_path()), new List<string>(), "chocolatey.console");

IList<string> folders = new List<string>
{
"helpers",
Expand Down

0 comments on commit 75346e6

Please sign in to comment.