mirror of https://github.com/perkeep/perkeep.git
localdisk: add IsDir
Change-Id: I98748d6cb8ff650e0369ef0518eeeefce73f0354
This commit is contained in:
parent
254239c379
commit
9a9da7196b
|
@ -34,12 +34,14 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"camlistore.org/pkg/blob"
|
||||
"camlistore.org/pkg/blobserver"
|
||||
"camlistore.org/pkg/blobserver/local"
|
||||
"camlistore.org/pkg/jsonconfig"
|
||||
"camlistore.org/pkg/osutil"
|
||||
"camlistore.org/pkg/types"
|
||||
)
|
||||
|
||||
|
@ -56,6 +58,14 @@ type DiskStorage struct {
|
|||
gen *local.Generationer
|
||||
}
|
||||
|
||||
// IsDir reports whether root is a localdisk (file-per-blob) storage directory.
|
||||
func IsDir(root string) (bool, error) {
|
||||
if osutil.DirExists(filepath.Join(root, blob.RefFromString("").HashName())) {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// New returns a new local disk storage implementation at the provided
|
||||
// root directory, which must already exist.
|
||||
func New(root string) (*DiskStorage, error) {
|
||||
|
|
Loading…
Reference in New Issue