fix: windows tempfile path in %USERPROFILE%\AppData\Local

#13
This commit is contained in:
ljun20160606 2018-05-23 15:53:19 +08:00
parent 5bf6a0e59d
commit e57a331e5c
3 changed files with 7 additions and 5 deletions

View File

@ -140,7 +140,7 @@ func (r *Runner) Start(ctxt context.Context) error {
_, ok = r.opts["user-data-dir"] _, ok = r.opts["user-data-dir"]
if !ok { if !ok {
r.opts["user-data-dir"], err = ioutil.TempDir( r.opts["user-data-dir"], err = ioutil.TempDir(
DefaultUserDataTmpDir, fmt.Sprintf(DefaultUserDataDirPrefix, r.Port()), defaultUserDataTmpDir, fmt.Sprintf(DefaultUserDataDirPrefix, r.Port()),
) )
if err != nil { if err != nil {
return err return err

View File

@ -7,10 +7,10 @@ import (
"syscall" "syscall"
) )
const ( var (
// DefaultUserDataTmpDir is the default directory path for created user // DefaultUserDataTmpDir is the default directory path for created user
// data directories. // data directories.
DefaultUserDataTmpDir = "/tmp" defaultUserDataTmpDir = "/tmp"
) )
// KillProcessGroup is a Chrome command line option that will instruct the // KillProcessGroup is a Chrome command line option that will instruct the

View File

@ -2,8 +2,10 @@
package runner package runner
const ( import "os"
DefaultUserDataTmpDir = `c:\temp`
var (
defaultUserDataTmpDir = os.Getenv("USERPROFILE") + `\AppData\Local`
) )
// KillProcessGroup is a Chrome command line option that will instruct the // KillProcessGroup is a Chrome command line option that will instruct the