File: path.go

package info (click to toggle)
golang-github-anacrolix-missinggo 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 836 kB
  • sloc: makefile: 4
file content (20 lines) | stat: -rw-r--r-- 327 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package missinggo

import (
	"os"
	"path"
)

// Splits the pathname p into Root and Ext, such that Root+Ext==p.
func PathSplitExt(p string) (ret struct {
	Root, Ext string
}) {
	ret.Ext = path.Ext(p)
	ret.Root = p[:len(p)-len(ret.Ext)]
	return
}

func FilePathExists(p string) bool {
	_, err := os.Stat(p)
	return err == nil
}