You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/10 17:49:00 UTC

[jira] [Commented] (AVRO-1955) avrogen.exe supports only windows platform

    [ https://issues.apache.org/jira/browse/AVRO-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16715226#comment-16715226 ] 

ASF GitHub Bot commented on AVRO-1955:
--------------------------------------

dkulp closed pull request #137: AVRO-1955: fix avrogen.exe output dir path format
URL: https://github.com/apache/avro/pull/137
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lang/csharp/src/apache/main/CodeGen/CodeGen.cs b/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
index aa31920c4..c8081fd6a 100644
--- a/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
+++ b/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
@@ -828,7 +828,11 @@ public virtual void WriteTypes(string outputdir)
             {
                 var ns = nsc[i];
 
-                string dir = outputdir + "\\" + CodeGenUtil.Instance.UnMangle(ns.Name).Replace('.', '\\');
+                string dir = outputdir;
+                foreach (string name in CodeGenUtil.Instance.UnMangle(ns.Name).Split('.'))
+                {
+                    dir = Path.Combine(dir, name);
+                }
                 Directory.CreateDirectory(dir);
 
                 var new_ns = new CodeNamespace(ns.Name);
@@ -840,7 +844,7 @@ public virtual void WriteTypes(string outputdir)
                 for (int j = 0; j < types.Count; j++)
                 {
                     var ctd = types[j];
-                    string file = dir + "\\" + CodeGenUtil.Instance.UnMangle(ctd.Name) + ".cs";
+                    string file = Path.Combine(dir, Path.ChangeExtension(CodeGenUtil.Instance.UnMangle(ctd.Name), "cs"));
                     using (var writer = new StreamWriter(file, false))
                     {
                         new_ns.Types.Add(ctd);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> avrogen.exe supports only windows platform
> ------------------------------------------
>
>                 Key: AVRO-1955
>                 URL: https://issues.apache.org/jira/browse/AVRO-1955
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: csharp
>            Reporter: Naruto TAKAHASHI
>            Assignee: Daniel Kulp
>            Priority: Major
>             Fix For: 1.9.0
>
>
> avrogen.exe output directory path separator is '\' .
> When executing avrogen.exe on macOS or Linux,  output directory path is not expected.
> e.g. sample.avsc
> {code:javascript}
> {
>   "type": "record",
>   "name": "ExampleModel",
>   "namespace": "com.example",
>   "fields": [
>     {
>       "name": "num",
>       "type": "long"
>     },
>     {
>       "name": "str",
>       "type": "string"
>     }
>   ]
> }
> {code}
> {code}
> mono ./build/codegen/Release/avrogen.exe -s sample.avsc output
> {code}
> avrogen.exe outputs below two regular files.
> - "output\com\example"
> - "output\com\example\ExampleModel.cs"
> avrogen.exe should use Path API of .NET when creating output directory path.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)