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

When using the path "./" or ".\" to retrieve a directory, an error stating that the path is not of a legal form is thrown by the .NET implementation. #2647

Open
Meertman opened this issue Oct 25, 2019 · 1 comment

Comments

@Meertman
Copy link

What You Are Seeing?

When retrieving a directory from disk, using the following code
var directoryPath = new DirectoryPath("./"); (or new DirectoryPath(@"."))
var directory = context.FileSystem.GetDirectory(directoryPath);

the following error is thrown:
Error: System.ArgumentException: The path is not of a legal form.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
at Cake.Core.IO.Directory..ctor(DirectoryPath path)
at Cake.Core.IO.FileSystem.GetDirectory(DirectoryPath path)

What is Expected?

The retrieval of the directory from disk.

What version of Cake are you using?

I've seen this error occur on 0.29 and 0.33

Are you running on a 32 or 64 bit system?

We are running a 64-bit system.

What environment are you running on? Windows? Linux? Mac?

We are running on Windows.

Are you running on a CI Server? If so, which one?

The issue occurs both on our build server (TeamCity), as well as on our local machines.

@Meertman
Copy link
Author

Created a gist containing a unit-test (using NUnit) that can be used to test for the issue:
https://gist.github.com/Meertman/ef6461c2adee967117f6500811bbe697

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

No branches or pull requests

1 participant