This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new 6eda0b4  fix avrogen.exe output dir path format using Path API
6eda0b4 is described below

commit 6eda0b41796d5d039ace7720bbd8066f0b7835e5
Author: Naruto TAKAHASHI <[email protected]>
AuthorDate: Fri Sep 30 11:43:59 2016 +0900

    fix avrogen.exe output dir path format using Path API
---
 lang/csharp/src/apache/main/CodeGen/CodeGen.cs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lang/csharp/src/apache/main/CodeGen/CodeGen.cs 
b/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
index c576200..35c4423 100644
--- a/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
+++ b/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
@@ -853,7 +853,11 @@ namespace Avro
             {
                 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);
@@ -865,7 +869,7 @@ namespace Avro
                 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);

Reply via email to