You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2017/05/12 21:52:12 UTC
[2/3] incubator-mynewt-newt git commit: Fixed windows path when
looking for a project file. newt commands were hanging if the current
directory is not the base directory.
Fixed windows path when looking for a project file.
newt commands were hanging if the current directory is not the base directory.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/4025e8df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/4025e8df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/4025e8df
Branch: refs/heads/master
Commit: 4025e8df099258e35346fd9ae7a5ad03c20917ee
Parents: 03416d7
Author: cwanda <wa...@happycity.com>
Authored: Fri May 5 07:25:49 2017 -0700
Committer: cwanda <wa...@happycity.com>
Committed: Fri May 5 08:32:00 2017 -0700
----------------------------------------------------------------------
newt/project/project.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/4025e8df/newt/project/project.go
----------------------------------------------------------------------
diff --git a/newt/project/project.go b/newt/project/project.go
index 75b0b31..4fd9802 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -85,6 +85,7 @@ func initProject(dir string) error {
func initialize() error {
if globalProject == nil {
wd, err := os.Getwd()
+ wd = filepath.ToSlash(wd)
if err != nil {
return util.NewNewtError(err.Error())
}
@@ -654,7 +655,9 @@ func findProjectDir(dir string) (string, error) {
// Move back one directory and continue searching
dir = path.Clean(dir + "../../")
- if dir == "/" {
+ // path.Clean returns . if processing results in empty string.
+ // Need to check for . on Windows.
+ if dir == "/" || dir == "." {
return "", util.NewNewtError("No project file found!")
}
}