Skip to content

Commit 843211b

Browse files
committed
use regex to properly get package files for local repos especially on Linux
1 parent 78a0cf6 commit 843211b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/code/LocalServerApiCalls.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -652,13 +652,15 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s
652652
var currentFiles = Directory.GetFiles(tempDiscoveryPath);
653653

654654
string psd1FilePath = String.Empty;
655+
string ps1FilePath = String.Empty;
655656
string nuspecFilePath = String.Empty;
656657
string pkgNamePattern = $"{packageName}*";
657658
Regex rgx = new(pkgNamePattern, RegexOptions.IgnoreCase);
658659
foreach (var x in currentFiles)
659660
{
660661
if (rgx.IsMatch(x))
661662
{
663+
_cmdletPassedIn.WriteVerbose("file is a match: " + x);
662664
if (x.EndsWith("psd1"))
663665
{
664666
psd1FilePath = x;
@@ -667,15 +669,13 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s
667669
{
668670
nuspecFilePath = x;
669671
}
672+
else if (x.EndsWith("ps1"))
673+
{
674+
ps1FilePath = x;
675+
}
670676
}
671-
_cmdletPassedIn.WriteVerbose($"file found: " + x);
672-
673-
}
674677

675-
foreach (var x in currentFiles)
676-
{
677678
_cmdletPassedIn.WriteVerbose($"file found: " + x);
678-
679679
}
680680

681681
var files = Directory.EnumerateFiles(tempDiscoveryPath, "*.*", SearchOption.AllDirectories).Where(
@@ -688,7 +688,7 @@ private Hashtable GetMetadataFromNupkg(string packageName, string packagePath, s
688688
}
689689

690690
// string psd1FilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.psd1");
691-
string ps1FilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.ps1");
691+
// string ps1FilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.ps1");
692692
// string nuspecFilePath = Path.Combine(tempDiscoveryPath, $"{packageName}.nuspec");
693693

694694
List<string> pkgTags = new List<string>();

0 commit comments

Comments
 (0)