Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize chtimes() implementation for non-linux platforms #27

Merged
merged 1 commit into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
13 changes: 13 additions & 0 deletions chtimes_nolinux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// +build !linux

package fsutil

import (
"os"
"time"
)

func chtimes(path string, un int64) error {
mtime := time.Unix(0, un)
return os.Chtimes(path, mtime, mtime)
}
7 changes: 0 additions & 7 deletions diskwriter_darwin.go

This file was deleted.

8 changes: 0 additions & 8 deletions diskwriter_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
package fsutil

import (
"os"
"time"

"github.com/pkg/errors"
)

func rewriteMetadata(p string, stat *Stat) error {
return chtimes(p, stat.ModTime)
}

func chtimes(path string, un int64) error {
mtime := time.Unix(0, un)
return os.Chtimes(path, mtime, mtime)
}

// handleTarTypeBlockCharFifo is an OS-specific helper function used by
// createTarFile to handle the following types of header: Block; Char; Fifo
func handleTarTypeBlockCharFifo(path string, stat *Stat) error {
Expand Down