initial commit

This commit is contained in:
2026-08-31 22:25:00 +01:00
commit d13ee5cf13
7 changed files with 216 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package sqan
import "strings"
func ParsePath(rootDir, absPath string) (relPath, relDir, filename, extension string) {
if absPath[0:len(rootDir)] != rootDir {
return
}
relPath = absPath[len(rootDir):]
if i := strings.LastIndexByte(relPath, '/'); i > -1 {
if i > 0 {
relDir = relPath[0:i]
} else {
relDir = "/"
}
filename = relPath[i+1:]
}
if i := strings.LastIndexByte(filename, '.'); i > -1 {
extension = strings.ToLower(filename[i+1:])
}
return
}