48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package settings
|
|
|
|
import (
|
|
"os"
|
|
"strconv"
|
|
"velvettear/dedupe/log"
|
|
)
|
|
|
|
// exported variable(s)
|
|
var Verbose bool
|
|
var Delete bool
|
|
var SourceDirectory string
|
|
var ComparisonDirectory string
|
|
var MoveDirectory string
|
|
|
|
// unexported function(s)
|
|
func setVerbose(verbose bool) {
|
|
Verbose = verbose
|
|
log.SetLogLevel(0)
|
|
log.Debug("set verbose flag", strconv.FormatBool(Verbose))
|
|
}
|
|
|
|
func setDelete(delete bool) {
|
|
Delete = delete
|
|
log.Debug("set delete flag", strconv.FormatBool(Delete))
|
|
}
|
|
|
|
func setSourceDirectory(directory string) {
|
|
SourceDirectory = directory
|
|
log.Debug("set source directory", SourceDirectory)
|
|
}
|
|
|
|
func setComparisonDirectory(directory string) {
|
|
ComparisonDirectory = directory
|
|
log.Debug("set source directory", ComparisonDirectory)
|
|
}
|
|
|
|
func setMoveDirectory(directory string) {
|
|
stats, error := os.Stat(directory)
|
|
if error != nil && os.IsNotExist(error) {
|
|
log.Fatal("given move directory '"+directory+"' does not exist", error.Error())
|
|
}
|
|
if !stats.IsDir() {
|
|
log.Fatal("given move directory '" + directory + "' is not a valid directory")
|
|
}
|
|
MoveDirectory = directory
|
|
log.Debug("set move directory", MoveDirectory)
|
|
}
|