go.tools/cmd/godex: permit absolute paths for gccgo-generated package (export) files

TBR=adonovan

TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/82030043
This commit is contained in:
Robert Griesemer 2014-03-28 15:17:20 -07:00
parent 7e60d06cfc
commit 723686bb4b
1 changed files with 5 additions and 2 deletions

View File

@ -21,13 +21,15 @@ import (
) )
func init() { func init() {
incpaths := []string{"/"}
// importer for default gccgo // importer for default gccgo
var inst gccgoimporter.GccgoInstallation var inst gccgoimporter.GccgoInstallation
inst.InitFromDriver("gccgo") inst.InitFromDriver("gccgo")
register("gccgo", inst.GetImporter(nil)) register("gccgo", inst.GetImporter(incpaths))
// importer for gccgo using condensed export format (experimental) // importer for gccgo using condensed export format (experimental)
register("gccgo-new", getNewImporter(append(inst.SearchPaths(), "."))) register("gccgo-new", getNewImporter(append(append(incpaths, inst.SearchPaths()...), ".")))
} }
// This function is an adjusted variant of gccgoimporter.GccgoInstallation.GetImporter. // This function is an adjusted variant of gccgoimporter.GccgoInstallation.GetImporter.
@ -72,6 +74,7 @@ func findExportFile(searchpaths []string, pkgpath string) (string, error) {
pkgdir + "lib" + name + ".a", pkgdir + "lib" + name + ".a",
pkgfullpath + ".o", pkgfullpath + ".o",
} { } {
println("trying", filepath)
fi, err := os.Stat(filepath) fi, err := os.Stat(filepath)
if err == nil && !fi.IsDir() { if err == nil && !fi.IsDir() {
return filepath, nil return filepath, nil