Skip to content

Commit

Permalink
fix: remove folder when no blocks are detected
Browse files Browse the repository at this point in the history
  • Loading branch information
costaluu committed Sep 20, 2024
1 parent ade1de4 commit 3fb1ac0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func ExtractMatchDataFromFile(path string) []types.Match {
id = match[3]
} else {
salt := utils.GetCurrentUnixTimestampInMs()

id = utils.GenerateId(path, feature, salt)
}

Expand Down Expand Up @@ -327,6 +327,12 @@ func RemoveAllUnsyncedBlocksFromPath(path string) {
filesystem.RemoveFile(filepath.Join(rootDir, ".features", "blocks", hashedPath, fmt.Sprintf("%s.block", feature.Id)))
}
}

features = ListBlocksFromPath(path)

if len(features) == 0 {
filesystem.FileDeleteFolder(filepath.Join(rootDir, ".features", "blocks", hashedPath))
}
}

func ToggleBlockFeature(featureName string, state string) {
Expand Down

0 comments on commit 3fb1ac0

Please sign in to comment.