fix: dst dir bug

This commit is contained in:
yanghao05
2025-03-29 18:15:27 +08:00
parent b2d909883e
commit a9d2c22541

View File

@@ -78,9 +78,9 @@ func Serve(cmd *cobra.Command, args []string) error {
func commandCompress(dir string) error {
dstPath := filepath.Join(dir, "compressed")
// check if the directory exists
if _, err := os.Stat(dir); os.IsNotExist(err) {
if err := os.MkdirAll(dir, 0o755); err != nil {
return errors.Wrapf(err, "failed to create directory: %s", dir)
if _, err := os.Stat(dstPath); os.IsNotExist(err) {
if err := os.MkdirAll(dstPath, 0o755); err != nil {
return errors.Wrapf(err, "failed to create directory: %s", dstPath)
}
}
if err := readDB(dir); err != nil {