summaryrefslogtreecommitdiff
path: root/vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-11-30 10:50:28 +0100
committerLibravatar GitHub <noreply@github.com>2023-11-30 10:50:28 +0100
commit0108463e7b179af1c796042dd10f4fe1020b9075 (patch)
treee18fb53a8950153be0a17060329b70ef5d222be8 /vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go
parent[performance/postgres] Rename constraints, remove duplicate indexes (#2392) (diff)
downloadgotosocial-0108463e7b179af1c796042dd10f4fe1020b9075.tar.xz
[bugfix] Update exif-terminator (fix png issue) (#2391)
* [bugfix] Update exif-terminator (fix png issue) * bump exif terminator * fix tests
Diffstat (limited to 'vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go')
-rw-r--r--vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go64
1 files changed, 0 insertions, 64 deletions
diff --git a/vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go b/vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go
deleted file mode 100644
index 9df13a858..000000000
--- a/vendor/github.com/dsoprea/go-png-image-structure/v2/testing_common.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package pngstructure
-
-import (
- "os"
- "path"
-
- "github.com/dsoprea/go-logging"
-)
-
-var (
- assetsPath = ""
-)
-
-func getModuleRootPath() string {
- moduleRootPath := os.Getenv("PNG_MODULE_ROOT_PATH")
- if moduleRootPath != "" {
- return moduleRootPath
- }
-
- currentWd, err := os.Getwd()
- log.PanicIf(err)
-
- currentPath := currentWd
- visited := make([]string, 0)
-
- for {
- tryStampFilepath := path.Join(currentPath, ".MODULE_ROOT")
-
- _, err := os.Stat(tryStampFilepath)
- if err != nil && os.IsNotExist(err) != true {
- log.Panic(err)
- } else if err == nil {
- break
- }
-
- visited = append(visited, tryStampFilepath)
-
- currentPath = path.Dir(currentPath)
- if currentPath == "/" {
- log.Panicf("could not find module-root: %v", visited)
- }
- }
-
- return currentPath
-}
-
-func getTestAssetsPath() string {
- if assetsPath == "" {
- moduleRootPath := getModuleRootPath()
- assetsPath = path.Join(moduleRootPath, "assets")
- }
-
- return assetsPath
-}
-
-func getTestBasicImageFilepath() string {
- assetsPath := getTestAssetsPath()
- return path.Join(assetsPath, "libpng.png")
-}
-
-func getTestExifImageFilepath() string {
- assetsPath := getTestAssetsPath()
- return path.Join(assetsPath, "exif.png")
-}