Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/System.Management.Automation/help/HelpProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ internal Collection<string> GetSearchPaths()
Diagnostics.Assert(searchPaths != null,
"HelpSystem returned an null search path");

searchPaths.Add(GetDefaultShellSearchPath());
string defaultShellSearchPath = GetDefaultShellSearchPath();
if (!searchPaths.Contains(defaultShellSearchPath))
{
searchPaths.Add(defaultShellSearchPath);
}

return searchPaths;
}
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/MUIFileSearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void AddFiles(string muiDirectory, string directory, string pattern)
string leafFileName = Path.GetFileName(file);
string uniqueToDirectory = Path.Combine(directory, leafFileName);

if (!_uniqueMatches.Contains(uniqueToDirectory))
if (!_result.Contains(path) && !_uniqueMatches.Contains(uniqueToDirectory))
{
_result.Add(path);
_uniqueMatches[uniqueToDirectory] = true;
Expand Down
21 changes: 21 additions & 0 deletions test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,24 @@ Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', '
}
}
}

Describe "Validate about_help.txt under culture specific folder works" -Tags @('CI') {
BeforeAll {
$modulePath = "$pshome\Modules\Test"
$null = New-Item -Path $modulePath\en-US -ItemType Directory -Force
New-ModuleManifest -Path $modulePath\test.psd1 -RootModule test.psm1
Set-Content -Path $modulePath\test.psm1 -Value "function foo{}"
Set-Content -Path $modulePath\en-US\about_testhelp.help.txt -Value "Hello" -NoNewline
}

AfterAll {
Remove-Item $modulePath -Recurse -Force
}

It "Get-Help should return help text and not multiple HelpInfo objects when help is under `$pshome path" {

$help = Get-Help about_testhelp
$help.count | Should Be 1
$help | Should BeExactly "Hello"
}
}