File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
src/ResourceManager/MachineLearning/Commands.MachineLearning Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ public override void ExecuteCmdlet()
50
50
ImportWebServiceDefinition . ImportFromFileParamSet ,
51
51
StringComparison . OrdinalIgnoreCase ) )
52
52
{
53
- jsonDefinition = CmdletHelpers . GetWebServiceDefinitionFromFile ( this . InputFile ) ;
53
+ jsonDefinition = CmdletHelpers . GetWebServiceDefinitionFromFile (
54
+ this . SessionState . Path . CurrentFileSystemLocation . Path ,
55
+ this . InputFile ) ;
54
56
}
55
57
56
58
WebService serviceDefinition = ModelsSerializationUtil . GetAzureMLWebServiceFromJsonDefinition ( jsonDefinition ) ;
Original file line number Diff line number Diff line change @@ -83,8 +83,12 @@ protected override void RunCmdlet()
83
83
NewAzureMLWebService . CreateFromFileParameterSet ,
84
84
StringComparison . OrdinalIgnoreCase ) )
85
85
{
86
- string jsonDefinition = CmdletHelpers . GetWebServiceDefinitionFromFile ( this . DefinitionFile ) ;
87
- this . NewWebServiceDefinition = ModelsSerializationUtil . GetAzureMLWebServiceFromJsonDefinition ( jsonDefinition ) ;
86
+ string jsonDefinition =
87
+ CmdletHelpers . GetWebServiceDefinitionFromFile (
88
+ this . SessionState . Path . CurrentFileSystemLocation . Path ,
89
+ this . DefinitionFile ) ;
90
+ this . NewWebServiceDefinition =
91
+ ModelsSerializationUtil . GetAzureMLWebServiceFromJsonDefinition ( jsonDefinition ) ;
88
92
}
89
93
90
94
WebService newWebService =
Original file line number Diff line number Diff line change @@ -49,10 +49,19 @@ internal static bool TryParseMlWebServiceMetadataFromResourceId(
49
49
return false ;
50
50
}
51
51
52
- internal static string GetWebServiceDefinitionFromFile ( string definitionFilePath )
52
+ internal static string GetWebServiceDefinitionFromFile ( string currentPath , string definitionFilePath )
53
53
{
54
- var definitionFileFullPath = Path . GetFullPath ( definitionFilePath ) ;
55
- if ( ! File . Exists ( definitionFileFullPath ) )
54
+ string definitionFileFullPath ;
55
+ if ( Path . IsPathRooted ( definitionFilePath ) )
56
+ {
57
+ definitionFileFullPath = definitionFilePath ;
58
+ }
59
+ else
60
+ {
61
+ definitionFileFullPath = Path . Combine ( currentPath , definitionFilePath ) ;
62
+ }
63
+
64
+ if ( ! File . Exists ( definitionFilePath ) )
56
65
{
57
66
throw new FileNotFoundException ( Resources . MissingDefinitionFile , definitionFilePath ) ;
58
67
}
You can’t perform that action at this time.
0 commit comments