Skip to content

Commit

Permalink
Expand environment variables in input paths (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanish-kh committed Nov 27, 2023
1 parent 0054c62 commit ad06a4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/WingetCreateCLI/Commands/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,11 @@ protected static string SaveManifestDirToLocalPath(
DefaultLocaleManifest defaultLocaleManifest = manifests.DefaultLocaleManifest;
List<LocaleManifest> localeManifests = manifests.LocaleManifests;

outputDir = Environment.ExpandEnvironmentVariables(outputDir);
string version = versionManifest.PackageVersion;
string packageId = versionManifest.PackageIdentifier;
string manifestDir = Utils.GetAppManifestDirPath(packageId, version);
string fullDirPath = Path.Combine(outputDir, manifestDir);
string fullDirPath = Path.GetFullPath(Path.Combine(outputDir, manifestDir));

try
{
Expand Down
10 changes: 6 additions & 4 deletions src/WingetCreateCLI/Commands/SubmitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,17 @@ public override async Task<bool> Execute()

private async Task<bool> SubmitManifest()
{
if (File.Exists(this.Path) && ValidateManifest(this.Path))
string expandedPath = System.Environment.ExpandEnvironmentVariables(this.Path);

if (File.Exists(expandedPath) && ValidateManifest(expandedPath))
{
Manifests manifests = new Manifests();
manifests.SingletonManifest = Serialization.DeserializeFromPath<SingletonManifest>(this.Path);
manifests.SingletonManifest = Serialization.DeserializeFromPath<SingletonManifest>(expandedPath);
return await this.GitHubSubmitManifests(manifests, this.PRTitle);
}
else if (Directory.Exists(this.Path) && ValidateManifest(this.Path))
else if (Directory.Exists(expandedPath) && ValidateManifest(expandedPath))
{
List<string> manifestContents = Directory.GetFiles(this.Path).Select(f => File.ReadAllText(f)).ToList();
List<string> manifestContents = Directory.GetFiles(expandedPath).Select(f => File.ReadAllText(f)).ToList();
Manifests manifests = Serialization.DeserializeManifestContents(manifestContents);
return await this.GitHubSubmitManifests(manifests, this.PRTitle);
}
Expand Down

0 comments on commit ad06a4e

Please sign in to comment.