-
Notifications
You must be signed in to change notification settings - Fork 228
Conversation
@@ -49,7 +49,7 @@ public bool TryResolveProject(string name, out Project project) | |||
|
|||
private void Initialize(string projectPath, string rootPath) | |||
{ | |||
_searchPaths.Add(Path.GetDirectoryName(projectPath)); | |||
_searchPaths.Add(new DirectoryInfo(projectPath).Parent.FullName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.GetFullPath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using FullName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant instead of this entire line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.GetDirectoryName(Path.GetFullPath(projectPath))
should do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.GetFullPath()
doesn't help here.
To make it clear, projectPath
is a directory, that may have a trailing slash. We want to get the parent dir of projectPath
.
The current approach is the most readable one. If you think newing an object here may increase program startup time, I can do a naïve trailing slash removal here (which actually is creating a new string object, so there is no too much difference).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.GetDirectoryName("this/is/a/path") returns "this/is/a"
Path.GetDirectoryName("this/is/a/path/") returns "this/is/a/path"
Path.GetFullPath() doesn't remove trailing slash for you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. I stand (or rather sit) corrected :)
I should add a test case covering this case. Adding test now. |
Added test |
745856d
to
7bd3b77
Compare
#1488
@davidfowl @muratg