fixing bug with config generation, started fixing add command, next commit command

This commit is contained in:
2020-07-04 22:05:02 -04:00
parent 5af55ed62e
commit c07e09d155
10 changed files with 256 additions and 44 deletions

View File

@@ -46,6 +46,7 @@ func NewManager(rootDir string, version string, dbPath string, informer chan Ope
informer,
dirPaths,
}
return &m, nil
}
@@ -112,13 +113,13 @@ func CreatePaths(rootDir string) error {
if err != nil {
return fmt.Errorf("unable to generate file paths.. %s", err)
}
InitiateDirectory(fullFilePaths.KeyFolder)
InitiateDirectory(fullFilePaths.DownloadFolder)
InitiateDirectory(fullFilePaths.SyncFolder)
InitiateDirectory(fullFilePaths.ObjectFolder)
InitiateDirectory(fullFilePaths.ThumbFolder)
InitiateDirectory(fullFilePaths.LogFolder)
InitiateDirectory(fullFilePaths.PluginFolder)
CreateDirectory(fullFilePaths.KeyFolder)
CreateDirectory(fullFilePaths.DownloadFolder)
CreateDirectory(fullFilePaths.SyncFolder)
CreateDirectory(fullFilePaths.ObjectFolder)
CreateDirectory(fullFilePaths.ThumbFolder)
CreateDirectory(fullFilePaths.LogFolder)
CreateDirectory(fullFilePaths.PluginFolder)
return nil
}
@@ -160,6 +161,7 @@ func (m *Manager) AddFileToRepo(relFilePath string) error {
if hash, err = UniqueFileHash(relFilePath); err != nil {
return err
}
m.Info().Msgf("Hash generated for file: %s hash: %s", relFilePath, hex.EncodeToString(hash))
alreadyTracked := m.dB.CheckIfFileCurrentlyMonitored(relFilePath)
if alreadyTracked {
return fmt.Errorf("file already found in tracked files, not adding: %s", relFilePath)