This commit is contained in:
simonzhangsz committed 2023-09-18 16:22:11 +08:00
1 parent 98fcdff349
commit e74b2f9b8a
2 files changed
+16 -6

No files matched your search

+15 -1
View File
@@ -640,7 +640,7 @@ func isDebPackage(file *os.File) bool {
return string(buffer) == string(magic)
}
func IsRpmOrDebPackage(filePath string) (int, error) {
func CheckRpmOrDebPackage(filePath string) (int, error) {
var fileType int = 0
file, err := os.Open(filePath)
if err != nil {
@@ -661,3 +661,17 @@ func IsRpmOrDebPackage(filePath string) (int, error) {
return fileType, nil
}
func IsRpmOrDebPackage(filePath string) int {
var fileType int = 0
if strings.Contains(filePath, ".rpm") {
fileType = 1
} else if strings.Contains(filePath, ".deb") {
fileType = 2
} else {
fileType = 0
}
return fileType
}