Skip to content

Commit

Permalink
pkg: Fix dir permission check on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
polyrabbit committed May 26, 2020
1 parent 747ff75 commit e06006e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/fileutil/dir_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@ package fileutil

import "os"

const (
// PrivateDirMode grants owner to make/remove files inside the directory.
PrivateDirMode = 0700
)

// OpenDir opens a directory for syncing.
func OpenDir(path string) (*os.File, error) { return os.Open(path) }
5 changes: 5 additions & 0 deletions pkg/fileutil/dir_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import (
"syscall"
)

const (
// PrivateDirMode grants owner to make/remove files inside the directory.
PrivateDirMode = 0777
)

// OpenDir opens a directory in windows with write access for syncing.
func OpenDir(path string) (*os.File, error) {
fd, err := openDir(path)
Expand Down
2 changes: 0 additions & 2 deletions pkg/fileutil/fileutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import (
const (
// PrivateFileMode grants owner to read/write a file.
PrivateFileMode = 0600
// PrivateDirMode grants owner to make/remove files inside the directory.
PrivateDirMode = 0700
)

// IsDirWriteable checks if dir is writable by writing and removing a file
Expand Down

0 comments on commit e06006e

Please sign in to comment.