Anonymous avatar Anonymous committed beadcf3

fix relative path as arg

Comments (0)

Files changed (1)

 }
 
 //TODO: send error messages to +Errors instead of Stderr?
+//TODO: keep a list of unfolded  dirs
+// because it will be faster to go through that list and find the right parent for a file when constructing the fullpath, than going recursively up
 
 func main() {
 	flag.Usage = usage
 	case 0:
 		root, _ = os.Getwd()
 	case 1:
-		root = args[0]
+		temp := path.Clean(args[0])
+		if temp[0] != '/' {
+			cwd, _ := os.Getwd()
+			root = path.Join(cwd, temp)
+		} else {
+			root = temp
+		}
 	default:
 		usage()
 	}
 	}
 	depth, line := getDepth(b)
 	fullpath := path.Join(root, getParents(charaddr, depth, 1), line)
-	fmt.Fprintf(os.Stdout, fullpath+"\n")
+	fmt.Fprintf(os.Stderr, fullpath+"\n")
 }
 
 func events() <-chan string {
 	go func() {
 		for e := range w.EventChan() {
 			switch e.C2 {
-			case 'x': // execute in body
+			case 'x': // execute in tag
 				switch string(e.Text) {
 				case "Del":
 					w.Ctl("delete")
 				default:
 					w.WriteEvent(e)
 				}
-			case 'X': // execute in tag
+			case 'X': // execute in body
 				c <- ("X" + fmt.Sprint(e.OrigQ0))
 			case 'l': // button 3 in tag
 				// let the plumber deal with it
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.