Clean up warnings and dates

This commit is contained in:
Terence Boldt 2024-03-11 21:16:02 -05:00
parent 375f1c764b
commit d9930ff85a
19 changed files with 48 additions and 27 deletions

View File

@ -1,4 +1,9 @@
#!/bin/bash #!/bin/bash
# Copyright Terence J. Boldt (c)2021-2024
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE file.
GOOS=darwin GOARCH=arm64 go build -o binaries/macos/apple-silicon/ProDOS-Utilities GOOS=darwin GOARCH=arm64 go build -o binaries/macos/apple-silicon/ProDOS-Utilities
GOOS=darwin GOARCH=amd64 go build -o binaries/macos/intel/ProDOS-Utilities GOOS=darwin GOARCH=amd64 go build -o binaries/macos/intel/ProDOS-Utilities
GOOS=windows GOARCH=amd64 go build -o binaries/windows/intel/ProDOS-Utilities.exe GOOS=windows GOARCH=amd64 go build -o binaries/windows/intel/ProDOS-Utilities.exe

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
@ -17,7 +17,7 @@ import (
"github.com/tjboldt/ProDOS-Utilities/prodos" "github.com/tjboldt/ProDOS-Utilities/prodos"
) )
const version = "0.4.9" const version = "0.5.0"
func main() { func main() {
var fileName string var fileName string

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2022-2023 // Copyright Terence J. Boldt (c)2022-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
@ -161,7 +161,10 @@ func CreateDirectory(readerWriter ReaderWriterAt, path string) error {
fileEntry.Version = 0x24 fileEntry.Version = 0x24
fileEntry.MinVersion = 0x00 fileEntry.MinVersion = 0x00
writeFileEntry(readerWriter, fileEntry) err = writeFileEntry(readerWriter, fileEntry)
if err != nil {
return err
}
err = incrementFileCount(readerWriter, fileEntry) err = incrementFileCount(readerWriter, fileEntry)
if err != nil { if err != nil {
@ -300,7 +303,10 @@ func expandDirectory(readerWriter ReaderWriterAt, buffer []byte, blockNumber uin
directoryFileEntry := parseFileEntry(buffer[directoryEntryOffset:directoryEntryOffset+0x28], directoryHeader.ParentBlock, directoryHeader.ParentEntry*uint16(directoryHeader.EntryLength)+0x04) directoryFileEntry := parseFileEntry(buffer[directoryEntryOffset:directoryEntryOffset+0x28], directoryHeader.ParentBlock, directoryHeader.ParentEntry*uint16(directoryHeader.EntryLength)+0x04)
directoryFileEntry.BlocksUsed++ directoryFileEntry.BlocksUsed++
directoryFileEntry.EndOfFile += 0x200 directoryFileEntry.EndOfFile += 0x200
writeFileEntry(readerWriter, directoryFileEntry) err = writeFileEntry(readerWriter, directoryFileEntry)
if err != nil {
return 0, err
}
return nextBlockNumber, nil return nextBlockNumber, nil
} }
@ -396,7 +402,7 @@ func parseFileEntry(buffer []byte, blockNumber uint16, entryOffset uint16) FileE
return fileEntry return fileEntry
} }
func writeFileEntry(writer io.WriterAt, fileEntry FileEntry) { func writeFileEntry(writer io.WriterAt, fileEntry FileEntry) error {
buffer := make([]byte, 39) buffer := make([]byte, 39)
buffer[0] = byte(fileEntry.StorageType)<<4 + byte(len(fileEntry.FileName)) buffer[0] = byte(fileEntry.StorageType)<<4 + byte(len(fileEntry.FileName))
for i := 0; i < len(fileEntry.FileName); i++ { for i := 0; i < len(fileEntry.FileName); i++ {
@ -429,8 +435,10 @@ func writeFileEntry(writer io.WriterAt, fileEntry FileEntry) {
//fmt.Printf("Writing file entry at block: %04X offset: %04X\n", fileEntry.DirectoryBlock, fileEntry.DirectoryOffset) //fmt.Printf("Writing file entry at block: %04X offset: %04X\n", fileEntry.DirectoryBlock, fileEntry.DirectoryOffset)
_, err := writer.WriteAt(buffer, int64(fileEntry.DirectoryBlock)*512+int64(fileEntry.DirectoryOffset)) _, err := writer.WriteAt(buffer, int64(fileEntry.DirectoryBlock)*512+int64(fileEntry.DirectoryOffset))
if err != nil { if err != nil {
return err
} }
return nil
} }
func parseVolumeHeader(buffer []byte) VolumeHeader { func parseVolumeHeader(buffer []byte) VolumeHeader {

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
@ -106,8 +106,10 @@ func WriteFile(readerWriter ReaderWriterAt, path string, fileType uint8, auxType
fileEntry.StorageType = StorageTree fileEntry.StorageType = StorageTree
} }
writeFileEntry(readerWriter, fileEntry) err = writeFileEntry(readerWriter, fileEntry)
if err != nil {
return err
}
return incrementFileCount(readerWriter, fileEntry) return incrementFileCount(readerWriter, fileEntry)
} }
@ -168,7 +170,10 @@ func DeleteFile(readerWriter ReaderWriterAt, path string) error {
// zero out directory entry // zero out directory entry
fileEntry.StorageType = 0 fileEntry.StorageType = 0
fileEntry.FileName = "" fileEntry.FileName = ""
writeFileEntry(readerWriter, fileEntry) err = writeFileEntry(readerWriter, fileEntry)
if err != nil {
return err
}
return nil return nil
} }
@ -422,7 +427,7 @@ func GetFileEntry(reader io.ReaderAt, path string) (FileEntry, error) {
return FileEntry{}, err return FileEntry{}, err
} }
if fileEntries == nil || len(fileEntries) == 0 { if len(fileEntries) == 0 {
return FileEntry{}, errors.New("file entry not found") return FileEntry{}, errors.New("file entry not found")
} }

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2022-2023 // Copyright Terence J. Boldt (c)2022-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
@ -28,6 +28,9 @@ func AddFilesFromHostDirectory(
) error { ) error {
path, err := makeFullPath(path, readerWriter) path, err := makeFullPath(path, readerWriter)
if err != nil {
return err
}
if !strings.HasSuffix(path, "/") { if !strings.HasSuffix(path, "/") {
path = path + "/" path = path + "/"

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright Terence J. Boldt (c)2021-2023 // Copyright Terence J. Boldt (c)2021-2024
// Use of this source code is governed by an MIT // Use of this source code is governed by an MIT
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.