updated the installer so that it should actually work
Some checks failed
Build / build (push) Failing after 5m23s
Some checks failed
Build / build (push) Failing after 5m23s
This commit is contained in:
28
examples/danklinux/pkg/ipp/utils.go
Normal file
28
examples/danklinux/pkg/ipp/utils.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package ipp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// ParseControlFile reads and decodes a cups control file into a response
|
||||
func ParseControlFile(jobID int, spoolDirectory string) (*Response, error) {
|
||||
if spoolDirectory == "" {
|
||||
spoolDirectory = "/var/spool/cups"
|
||||
}
|
||||
|
||||
controlFilePath := path.Join(spoolDirectory, fmt.Sprintf("c%d", jobID))
|
||||
|
||||
if _, err := os.Stat(controlFilePath); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
controlFile, err := os.Open(controlFilePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer controlFile.Close()
|
||||
|
||||
return NewResponseDecoder(controlFile).Decode(nil)
|
||||
}
|
||||
Reference in New Issue
Block a user