Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entitas/Generate: 'Path contains invalid chars' on Windows #6

Closed
andrkish opened this issue Jun 28, 2015 · 6 comments
Closed

Entitas/Generate: 'Path contains invalid chars' on Windows #6

andrkish opened this issue Jun 28, 2015 · 6 comments
Labels

Comments

@andrkish
Copy link

Windows 8.1
Unity 5.1.0f3
Entitas version 0.17.0 from bin/Entitas.zip

Entitas/Generate from menu throw an exception:

ArgumentException: Path contains invalid chars
System.IO.Directory.CreateDirectory (System.String path) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/Directory.cs:81)
Entitas.CodeGenerator.CodeGenerator.CleanDir (System.String dir) (at Assets/Libraries/Entitas.CodeGenerator/CodeGenerator.cs:57)
Entitas.CodeGenerator.CodeGenerator.Generate (System.Type[] types, System.String[] poolNames, System.String dir, Entitas.CodeGenerator.IComponentCodeGenerator[] componentCodeGenerators, Entitas.CodeGenerator.ISystemCodeGenerator[] systemCodeGenerators, Entitas.CodeGenerator.IPoolCodeGenerator[] poolCodeGenerators) (at Assets/Libraries/Entitas.CodeGenerator/CodeGenerator.cs:15)
Entitas.Unity.CodeGenerator.CodeGeneratorEditor.Generate () (at Assets/Libraries/Entitas.Unity.CodeGenerator/Editor/CodeGeneratorEditor.cs:29)

Properties.cs

string[] getLinesWithProperties(string properties) {
            var delimiter = new[] { Environment.NewLine };         
            return properties
                .Split(delimiter, StringSplitOptions.RemoveEmptyEntries)
                .Select(line => line.TrimStart(' '))
                .Where(line => !line.StartsWith("#", StringComparison.Ordinal))
                .ToArray();
        }

properties comes in this format:

    properties  "Entitas.Unity.CodeGenerator.GeneratedFolderPath = Assets/Generated/\\nEntitas.Unity.CodeGenerator.Pools = \\nEntitas.Unity.VisualDebugging.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/\\nEntitas.Unity.VisualDebugging.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/\\n\\nEntitas.Unity.CodeGenerator.Pools = PoolName\\nEntitas.Unity.VisualDebugging.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/\\nEntitas.Unity.VisualDebugging.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/\\n\nEntitas.Unity.CodeGenerator.Pools = PoolName\nEntitas.Unity.VisualDebugging.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/\nEntitas.Unity.VisualDebugging.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/\n"   System.String

where delimiters "\n" and "\n", but expected "\r\n" (from Environment.NewLine )

dirty fix that helped
replace
var delimiter = new[] { Environment.NewLine };
to
var delimiter = new[] {"\n", "\\n"};

With default setup
image

@sschmid
Copy link
Owner

sschmid commented Jun 28, 2015

Thanks! I will try to get a Windows machine to reproduce and work on a fix.

@sschmid sschmid added the bug label Jun 30, 2015
@sschmid sschmid changed the title Entitas/Generate throw an exception on Windows "Path contains invalid chars" on Windows Jun 30, 2015
@sschmid sschmid changed the title "Path contains invalid chars" on Windows Entitas/Generate: "Path contains invalid chars" on Windows Jun 30, 2015
@sschmid sschmid changed the title Entitas/Generate: "Path contains invalid chars" on Windows Entitas/Generate: 'Path contains invalid chars' on Windows Jun 30, 2015
@a-m-svetlov
Copy link

Hello.
The best C#-way to fix that will replace

var delimiter = new[] { Environment.NewLine };

with

var delimiter = Environment.NewLine.ToCharArray();

And also using Environment.NewLine in .Replace methods.

Best regards.

@sschmid
Copy link
Owner

sschmid commented Jul 9, 2015

Hi, I set up a windows machine and made some changes. Line endings are now converted before the input string is parsed. I released a new version, which should fix the problem.
Please try the new version and let me know if it works for you.
https://github.com/sschmid/Entitas-CSharp/releases/tag/0.18.0

@a-m-svetlov
Copy link

Thanks!

@LinusVanElswijk
Copy link

I can confirm that the update has solved the issue. :)
(Windows 8.1/Unity 5.1.1f1)

@sschmid sschmid closed this as completed Jul 12, 2015
@andrkish
Copy link
Author

Thanks! Work like a charm. )

p.s. i am apologize for late response. (was in vacation without access to PC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

4 participants