diff --git a/tool.go b/tool.go index 1e6123c97..3786797be 100644 --- a/tool.go +++ b/tool.go @@ -223,7 +223,10 @@ func main() { return fmt.Errorf("gopherjs run: no go files listed") } - tempfile, err := ioutil.TempFile("", filepath.Base(args[0])+".") + tempfile, err := ioutil.TempFile(currentDirectory, filepath.Base(args[0])+".") + if err != nil && strings.HasPrefix(currentDirectory, runtime.GOROOT()) { + tempfile, err = ioutil.TempFile("", filepath.Base(args[0])+".") + } if err != nil { return err } @@ -363,7 +366,7 @@ func main() { return err } - tempfile, err := ioutil.TempFile("", "test.") + tempfile, err := ioutil.TempFile(currentDirectory, "test.") if err != nil { return err }