Skip to content

Commit 1dae8cc

Browse files
author
Klein Hu
committed
Support relative path in Import-, Export- and New-
1 parent 516a1f0 commit 1dae8cc

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

src/ResourceManager/MachineLearning/Commands.MachineLearning.Test/Commands.MachineLearning.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6060
<Private>True</Private>
6161
</Reference>
62-
<Reference Include="..\..\..\packages\Microsoft.Azure.Management.MachineLearning.0.9.0-preview\lib\net45\Microsoft.Azure.Management.MachineLearning.dll">
62+
<Reference Include="..\..\..\packages\Microsoft.Azure.Management.MachineLearning.0.9.3-preview\lib\net45\Microsoft.Azure.Management.MachineLearning.dll">
6363
<Name>Microsoft.Azure.Management.MachineLearning</Name>
6464
<Private>True</Private>
6565
</Reference>

src/ResourceManager/MachineLearning/Commands.MachineLearning.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="1.0.2" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.MachineLearning" version="0.9.0-preview" />
9+
<package id="Microsoft.Azure.Management.MachineLearning" version="0.9.3-preview" />
1010
<package id="Microsoft.Azure.Management.Storage" version="3.0.0" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Test.Framework" version="1.0.5945.28173-prerelease" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.0-preview" targetFramework="net45" />

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/ExportWebServiceDefinition.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,19 @@ public override void ExecuteCmdlet()
6767

6868
if (!string.IsNullOrWhiteSpace(this.OutputFile))
6969
{
70-
bool fileExisting = File.Exists(this.OutputFile);
70+
var currentPath = this.SessionState.Path.CurrentFileSystemLocation.Path;
71+
var definitionFileFullPath =
72+
Path.IsPathRooted(this.OutputFile) ?
73+
this.OutputFile :
74+
Path.Combine(currentPath, this.OutputFile);
75+
76+
bool fileExisting = File.Exists(definitionFileFullPath);
7177
this.ConfirmAction(
7278
this.Force || !fileExisting,
7379
"Want to overwriting the output file?",
7480
"Overwriting the output file",
75-
this.OutputFile,
76-
() => File.WriteAllText(this.OutputFile, serializedDefinition));
81+
definitionFileFullPath,
82+
() => File.WriteAllText(definitionFileFullPath, serializedDefinition));
7783
}
7884
else
7985
{

src/ResourceManager/MachineLearning/Commands.MachineLearning/Commands.MachineLearning.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<Prefer32Bit>false</Prefer32Bit>
4848
</PropertyGroup>
4949
<ItemGroup>
50-
<Reference Include="..\..\..\packages\Microsoft.Azure.Management.MachineLearning.0.9.0-preview\lib\net45\Microsoft.Azure.Management.MachineLearning.dll">
50+
<Reference Include="..\..\..\packages\Microsoft.Azure.Management.MachineLearning.0.9.3-preview\lib\net45\Microsoft.Azure.Management.MachineLearning.dll">
5151
<Name>Microsoft.Azure.Management.MachineLearning</Name>
5252
<Private>True</Private>
5353
</Reference>

src/ResourceManager/MachineLearning/Commands.MachineLearning/Utilities/CmdletHelpers.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,17 @@ internal static bool TryParseMlWebServiceMetadataFromResourceId(
5151

5252
internal static string GetWebServiceDefinitionFromFile(string currentPath, string definitionFilePath)
5353
{
54-
string definitionFileFullPath;
55-
if (Path.IsPathRooted(definitionFilePath))
56-
{
57-
definitionFileFullPath = definitionFilePath;
58-
}
59-
else
60-
{
61-
definitionFileFullPath = Path.Combine(currentPath, definitionFilePath);
62-
}
54+
var definitionFileFullPath =
55+
Path.IsPathRooted(definitionFilePath) ?
56+
definitionFilePath :
57+
Path.Combine(currentPath, definitionFilePath);
6358

64-
if (!File.Exists(definitionFilePath))
59+
if (!File.Exists(definitionFileFullPath))
6560
{
66-
throw new FileNotFoundException(Resources.MissingDefinitionFile, definitionFilePath);
61+
throw new FileNotFoundException(Resources.MissingDefinitionFile, definitionFileFullPath);
6762
}
6863

69-
return File.ReadAllText(definitionFilePath);
64+
return File.ReadAllText(definitionFileFullPath);
7065
}
7166
}
7267
}

src/ResourceManager/MachineLearning/Commands.MachineLearning/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.1.0" targetFramework="net45" />
1111
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.0.1-preview" targetFramework="net45" />
1212
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
13-
<package id="Microsoft.Azure.Management.MachineLearning" version="0.9.0-preview" />
13+
<package id="Microsoft.Azure.Management.MachineLearning" version="0.9.3-preview" />
1414
</packages>

0 commit comments

Comments
 (0)