28 lines
635 B
Go
28 lines
635 B
Go
|
package main
|
||
|
|
||
|
import(
|
||
|
"log"
|
||
|
"io/ioutil"
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
func checkRootFolder(storage string) {
|
||
|
files, err := ioutil.ReadDir(storage)
|
||
|
if err != nil { log.Fatal(err) }
|
||
|
|
||
|
checked_folders := map[string]bool{"fs": false, "commits": false, "blocks": false}
|
||
|
for _, f := range files {
|
||
|
if _, ok := checked_folders[f.Name()]; ok {
|
||
|
info, err := os.Stat(filepath.Join(storage, f.Name()));
|
||
|
if err == nil && info.IsDir() {
|
||
|
checked_folders[f.Name()] = true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for path, seen := range checked_folders {
|
||
|
if !seen { log.Fatal("Folder ", path, " is required but not present!") }
|
||
|
}
|
||
|
}
|