Merge pull request #554 from jmorganca/mxyng/fix-windows-startup

fix mkdir on windows
This commit is contained in:
Michael Yang 2023-09-19 09:42:12 -07:00 committed by GitHub
commit 2627c464ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -722,7 +722,7 @@ func initializeKeypair() error {
return err return err
} }
err = os.MkdirAll(path.Dir(privKeyPath), 0o700) err = os.MkdirAll(filepath.Dir(privKeyPath), 0o755)
if err != nil { if err != nil {
return fmt.Errorf("could not create directory %w", err) return fmt.Errorf("could not create directory %w", err)
} }

View file

@ -14,7 +14,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -82,7 +82,7 @@ func getAuthToken(ctx context.Context, redirData AuthRedirect) (string, error) {
return "", err return "", err
} }
keyPath := path.Join(home, ".ollama", "id_ed25519") keyPath := filepath.Join(home, ".ollama", "id_ed25519")
rawKey, err := os.ReadFile(keyPath) rawKey, err := os.ReadFile(keyPath)
if err != nil { if err != nil {

View file

@ -8,7 +8,7 @@ import (
"log" "log"
"net/http" "net/http"
"os" "os"
"path" "path/filepath"
"strconv" "strconv"
"sync" "sync"
"time" "time"
@ -173,7 +173,7 @@ func doDownload(ctx context.Context, opts downloadOpts, f *FileDownload) error {
return fmt.Errorf("%w: on download registry responded with code %d: %v", errDownload, resp.StatusCode, string(body)) return fmt.Errorf("%w: on download registry responded with code %d: %v", errDownload, resp.StatusCode, string(body))
} }
err = os.MkdirAll(path.Dir(f.FilePath), 0o700) err = os.MkdirAll(filepath.Dir(f.FilePath), 0o700)
if err != nil { if err != nil {
return fmt.Errorf("make blobs directory: %w", err) return fmt.Errorf("make blobs directory: %w", err)
} }

View file

@ -1161,8 +1161,8 @@ func PushModel(ctx context.Context, name string, regOpts *RegistryOptions, fn fu
return err return err
} }
if strings.HasPrefix(path.Base(location.Path), "sha256:") { if strings.HasPrefix(filepath.Base(location.Path), "sha256:") {
layer.Digest = path.Base(location.Path) layer.Digest = filepath.Base(location.Path)
fn(api.ProgressResponse{ fn(api.ProgressResponse{
Status: "using existing layer", Status: "using existing layer",
Digest: layer.Digest, Digest: layer.Digest,