From 9b8d877e81656602cb7f0d02d86b076aa656c2d6 Mon Sep 17 00:00:00 2001 From: milarin Date: Sun, 15 Jan 2023 14:12:16 +0100 Subject: [PATCH] debug --- handle_file.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/handle_file.go b/handle_file.go index bb39036..db6996f 100644 --- a/handle_file.go +++ b/handle_file.go @@ -1,7 +1,6 @@ package main import ( - "errors" "io" "os" "path/filepath" @@ -77,55 +76,39 @@ func OrganizeAnimeEpisode(b *strings.Builder, parsedFile *model.ParsedFile) erro return err } - b.WriteString("1") - if err := os.Chown(filepath.Dir(newFile), Uid, Gid); err != nil { return err } - b.WriteString("2") - - if _, err := os.Stat(newFile); !errors.Is(err, os.ErrNotExist) { + if _, err := os.Stat(newFile); err != nil { // !errors.Is(err, os.ErrNotExist) return err } - b.WriteString("3") - inputFile, err := os.Open(oldFile) if err != nil { return err } defer inputFile.Close() - b.WriteString("4") - outputFile, err := os.Create(newFile) if err != nil { return err } defer outputFile.Close() - b.WriteString("5") - if err := os.Chown(newFile, Uid, Gid); err != nil { return err } - b.WriteString("6") - written, err := io.Copy(outputFile, inputFile) if err != nil { return err } - b.WriteString("7 " + FormatBytes(written)) - if err = os.Remove(oldFile); err != nil { return err } - b.WriteString("8") - if err = os.Remove(lockFile); err != nil { return err }