Skip to content

Commit 548b717

Browse files
committed
fix relative path issue
1 parent ade602e commit 548b717

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/Resources/ResourceManager/Implementation/CmdletBase/ResourceWithParameterCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ protected void BuildAndUseBicepTemplate()
419419
{
420420
if (BicepUtility.IsBicepFile(TemplateFile))
421421
{
422-
TemplateFile = BicepUtility.BuildFile(this.ExecuteScript<Object>, TemplateFile);
422+
TemplateFile = BicepUtility.BuildFile(this.ExecuteScript<Object>, this.ResolvePath(TemplateFile));
423423
}
424424

425425
if (BicepUtility.IsBicepFile(TemplateUri))

src/Resources/ResourceManager/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Resources/ResourceManager/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,7 @@ You can help us improve the accuracy of the result by opening an issue here: htt
497497
<data name="BicepNotFound" xml:space="preserve">
498498
<value>Cannot find Bicep. Please add Bicep to your PATH or visit https://github.com/Azure/bicep/releases to install Bicep.</value>
499499
</data>
500+
<data name="InvalidBicepFilePathOrUri" xml:space="preserve">
501+
<value>Invalid Bicep file path or uri.</value>
502+
</data>
500503
</root>

src/Resources/ResourceManager/Utilities/BicepUtility.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public static string BuildFile<T>(ScriptExecutor<T> executeScript, string bicepT
6666
{
6767
File.Copy(bicepTemplateFilePath, tempPath, true);
6868
}
69+
else
70+
{
71+
throw new AzPSArgumentException(Properties.Resources.InvalidBicepFilePathOrUri, bicepTemplateFilePath);
72+
}
6973
executeScript($"bicep build '{tempPath}'");
7074
return tempPath.Replace(".bicep", ".json");
7175
}

0 commit comments

Comments
 (0)