summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2020-03-22 18:42:35 +1000
committerJames Mills <prologic@shortcircuit.net.au>2020-03-22 18:42:35 +1000
commit8ae65e4b73eb0d4269a7e0a50827df3d7d761481 (patch)
treecfbcf46e5813b813dc851bfdb9cd1d2d50c5c0ee /utils
parent7492a150ebf1d81782bd113140ad213354d6c107 (diff)
Don't generate new thumbnails if they already exist
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go
index 0ca1cea..b7ab28f 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -3,10 +3,21 @@ package utils
import (
"context"
"fmt"
+ "os"
"os/exec"
"time"
)
+// FileExists ...
+func FileExists(name string) bool {
+ if _, err := os.Stat(name); err != nil {
+ if os.IsNotExist(err) {
+ return false
+ }
+ }
+ return true
+}
+
// CmdExists ...
func CmdExists(cmd string) bool {
_, err := exec.LookPath(cmd)