Skip to content

Commit

Permalink
(chocolatey#2953) Store Cygwin rootDirectory in static field
Browse files Browse the repository at this point in the history
Currently, ISourceRunner instances seem to be managed as transient.
This is reasonable for many things, but it means we cannot rely on
storing state in instance fields for ISourceRunner instances at the
current time.

This change ensures that the state data created by
ensure_source_app_installed() can be kept around for the followup call
to install_run() by storing it in a static field that all instances
can make use of.

We may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
  • Loading branch information
vexx32 committed Feb 14, 2023
1 parent 7ae8339 commit a244c7c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public sealed class CygwinService : ISourceRunner
private const string PACKAGE_NAME_TOKEN = "{{packagename}}";
private const string INSTALL_ROOT_TOKEN = "{{installroot}}";
public const string CYGWIN_PACKAGE = "cygwin";
private string _rootDirectory = string.Empty;
private static string _rootDirectory = string.Empty;

private const string APP_NAME = "Cygwin";
public const string PACKAGE_NAME_GROUP = "PkgName";
Expand Down

0 comments on commit a244c7c

Please sign in to comment.