Skip to content

Commit

Permalink
Linux friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
zijianhuang committed Jun 10, 2024
1 parent b260319 commit a0c7f96
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Fonlow.OpenApiClientGen.CS/ControllersClientApiGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void GenerateCodesToWriter(TextWriter textWriter)
string s = streamReader.ReadToEnd();
if (settings.UseEnsureSuccessStatusCodeEx && settings.IncludeEnsureSuccessStatusCodeExBlock)
{
textWriter.Write(s.Replace("//;", "").Replace(dummyBlock, blockOfEnsureSuccessStatusCodeEx));
textWriter.Write(s.Replace("//;", "").Replace(dummyBlock, System.OperatingSystem.IsWindows()? blockOfEnsureSuccessStatusCodeEx : GetBlockOfEnsureSuccessStatusCodeExForLinux()));
}
else
{
Expand Down Expand Up @@ -315,6 +315,14 @@ void CreateDummyOfEnsureSuccessStatusCodeEx()
codeCompileUnit.Namespaces.Add(new CodeNamespace("ZZZzzzEnsureSuccessStatusCodeExDummy"));
}

string GetBlockOfEnsureSuccessStatusCodeExForLinux()
{
return blockOfEnsureSuccessStatusCodeEx.ReplaceLineEndings();
}

/// <summary>
/// Code block for Windows with \r\n
/// </summary>
const string blockOfEnsureSuccessStatusCodeEx =
@"
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwagApiTests/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"CommandPath": "dotnet",
"Arguments": "run --no-build --configuration Release --project ../../../../../PetWebApi/PetWebApi.csproj",
"BaseUrl": "http://127.0.0.1:5000/",
"Delay": 3
"Delay": 5
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwagApiTestsTextJson/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"CommandPath": "dotnet",
"Arguments": "run --no-build --configuration Release --project ../../../../../PetWebApi/PetWebApi.csproj --launch-profile PetWebApiForTextJson",
"BaseUrl": "http://127.0.0.1:6000/",
"Delay": 3
"Delay": 5
}
]
}
Expand Down

0 comments on commit a0c7f96

Please sign in to comment.