Skip to content

Commit ceec33e

Browse files
authored
Fixed the issue when support help and psd1 in {module}.Management folder (#20674)
Assume help folder and psd1 are in the same folder
1 parent 7c135d8 commit ceec33e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/Gen2Master/MoveFromGeneration2Master.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,12 @@ Function Move-Generation2MasterHybrid {
259259
}
260260

261261
#copy generated docs to help folder
262-
Copy-Item -Path ("$SourcePath\{0}\docs\*" -f $submoduleDir.Name) -Destination "$DestPath\$ModuleName\help" -Filter *-*
262+
#Assume psd1 and help are in the same folder.
263+
$Psd1FolderPostfix = '';
264+
if (-not (Test-Path (Join-Path -Path (Join-Path -Path $DestPath -ChildPath $ModuleName) -ChildPath "Az.$ModuleName.psd1"))) {
265+
$Psd1FolderPostfix = '.Management'
266+
}
267+
Copy-Item -Path ("$SourcePath\{0}\docs\*" -f $submoduleDir.Name) -Destination "$DestPath\$ModuleName$Psd1FolderPostfix\help" -Filter *-*
263268

264269
#Region generate-info.json Here have a issue that user may not use latest version to generate the code.
265270
$generateInfo = @{}
@@ -299,10 +304,6 @@ Function Move-Generation2MasterHybrid {
299304
dotnet sln $SolutionPath add (Join-Path -Path (Join-Path -Path $DestPath -ChildPath $submoduleDir.Name) -ChildPath Az.$submoduleName.csproj)
300305

301306
# Update psd1
302-
$Psd1FolderPostfix = '';
303-
if (-not (Test-Path (Join-Path -Path (Join-Path -Path $DestPath -ChildPath $ModuleName) -ChildPath "Az.$ModuleName.psd1"))) {
304-
$Psd1FolderPostfix = '.Management'
305-
}
306307
$DestPsd1Path = Join-Path -Path (Join-Path -Path $DestPath -ChildPath $ModuleName$Psd1FolderPostfix) -ChildPath "Az.$ModuleName.psd1"
307308
$Psd1Metadata = Import-LocalizedData -BaseDirectory (Join-Path -Path $DestPath -ChildPath $ModuleName$Psd1FolderPostfix) -FileName "Az.$ModuleName.psd1"
308309
$SubModulePsd1MetaData = Import-LocalizedData -BaseDirectory (Join-Path -Path $SourcePath -ChildPath $submoduleDir.Name) -FileName "Az.$submoduleName.psd1"

0 commit comments

Comments
 (0)