mirror of
https://github.com/tjboldt/ProDOS-Utilities.git
synced 2024-11-24 16:31:28 +00:00
Fix warnings
This commit is contained in:
parent
d9930ff85a
commit
46cfc454c5
13
main.go
13
main.go
@ -89,6 +89,10 @@ func dumpFile(fileName string, pathName string) {
|
||||
}
|
||||
defer file.Close()
|
||||
fileEntry, err := prodos.GetFileEntry(file, pathName)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to path %s:\n %s", pathName, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
prodos.DumpFileEntry(fileEntry)
|
||||
}
|
||||
|
||||
@ -101,6 +105,10 @@ func dumpDirectory(fileName string, pathName string) {
|
||||
}
|
||||
defer file.Close()
|
||||
_, directoryheader, _, err := prodos.ReadDirectory(file, pathName)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to read directory %s:\n %s", pathName, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
prodos.DumpDirectoryHeader(directoryheader)
|
||||
}
|
||||
|
||||
@ -200,6 +208,9 @@ func put(fileName string, pathName string, fileType uint8, auxType uint16, inFil
|
||||
}
|
||||
defer file.Close()
|
||||
fileInfo, err := os.Stat(fileName)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed get fileInfo for %s - %s", fileName, err)
|
||||
}
|
||||
|
||||
err = prodos.WriteFileFromFile(file, pathName, fileType, auxType, fileInfo.ModTime(), inFileName, false)
|
||||
if err != nil {
|
||||
@ -229,7 +240,7 @@ func get(fileName string, pathName string, outFileName string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
if strings.HasSuffix(strings.ToLower(outFileName), ".bas") {
|
||||
fmt.Fprintf(outFile, prodos.ConvertBasicToText(getFile))
|
||||
fmt.Fprint(outFile, prodos.ConvertBasicToText(getFile))
|
||||
} else {
|
||||
outFile.Write(getFile)
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ func TestConvertTextToBasic(t *testing.T) {
|
||||
testname := tt.name
|
||||
t.Run(testname, func(t *testing.T) {
|
||||
basic, _ := ConvertTextToBasic(tt.basicText)
|
||||
if bytes.Compare(basic, tt.want) != 0 {
|
||||
if !bytes.Equal(basic, tt.want) {
|
||||
t.Errorf("%s\ngot '%#v'\nwant '%#v'\n", testname, basic, tt.want)
|
||||
}
|
||||
})
|
||||
|
@ -277,7 +277,7 @@ func expandDirectory(readerWriter ReaderWriterAt, buffer []byte, blockNumber uin
|
||||
nextBlockNumber := blockList[0]
|
||||
buffer[0x02] = byte(nextBlockNumber & 0x00FF)
|
||||
buffer[0x03] = byte(nextBlockNumber >> 8)
|
||||
WriteBlock(readerWriter, blockNumber, buffer)
|
||||
err = WriteBlock(readerWriter, blockNumber, buffer)
|
||||
if err != nil {
|
||||
errString := fmt.Sprintf("failed to write block to expand directory: %s", err)
|
||||
return 0, errors.New(errString)
|
||||
|
Loading…
Reference in New Issue
Block a user