Explorar o código

Use filepath.IsAbs to see if temp directory is local. Fixes a problem on Windows, since the old code assumed a rooted path starts with /.

Rob Pike %!s(int64=12) %!d(string=hai) anos
pai
achega
496d3b747b
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      glog_file.go

+ 2 - 1
glog_file.go

@@ -25,6 +25,7 @@ import (
 	"os"
 	"os"
 	"os/user"
 	"os/user"
 	"path"
 	"path"
+	"path/filepath"
 	"strings"
 	"strings"
 	"sync"
 	"sync"
 	"time"
 	"time"
@@ -55,7 +56,7 @@ func createLogDirs() {
 		if len(dir) == 0 {
 		if len(dir) == 0 {
 			continue
 			continue
 		}
 		}
-		if dir[0] != '/' {
+		if !filepath.IsAbs(dir) {
 			dir = "/" + dir
 			dir = "/" + dir
 		}
 		}
 		logDirs = append(logDirs, dir)
 		logDirs = append(logDirs, dir)