mirror of
https://github.com/tjboldt/ProDOS-Utilities.git
synced 2024-12-27 05:29:49 +00:00
Clean up warnings and dates
This commit is contained in:
parent
375f1c764b
commit
d9930ff85a
5
build.sh
5
build.sh
@ -1,4 +1,9 @@
|
||||
#!/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=amd64 go build -o binaries/macos/intel/ProDOS-Utilities
|
||||
GOOS=windows GOARCH=amd64 go build -o binaries/windows/intel/ProDOS-Utilities.exe
|
||||
|
4
main.go
4
main.go
@ -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
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
"github.com/tjboldt/ProDOS-Utilities/prodos"
|
||||
)
|
||||
|
||||
const version = "0.4.9"
|
||||
const version = "0.5.0"
|
||||
|
||||
func main() {
|
||||
var fileName string
|
||||
|
@ -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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -161,7 +161,10 @@ func CreateDirectory(readerWriter ReaderWriterAt, path string) error {
|
||||
fileEntry.Version = 0x24
|
||||
fileEntry.MinVersion = 0x00
|
||||
|
||||
writeFileEntry(readerWriter, fileEntry)
|
||||
err = writeFileEntry(readerWriter, fileEntry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = incrementFileCount(readerWriter, fileEntry)
|
||||
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.BlocksUsed++
|
||||
directoryFileEntry.EndOfFile += 0x200
|
||||
writeFileEntry(readerWriter, directoryFileEntry)
|
||||
err = writeFileEntry(readerWriter, directoryFileEntry)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return nextBlockNumber, nil
|
||||
}
|
||||
@ -396,7 +402,7 @@ func parseFileEntry(buffer []byte, blockNumber uint16, entryOffset uint16) FileE
|
||||
return fileEntry
|
||||
}
|
||||
|
||||
func writeFileEntry(writer io.WriterAt, fileEntry FileEntry) {
|
||||
func writeFileEntry(writer io.WriterAt, fileEntry FileEntry) error {
|
||||
buffer := make([]byte, 39)
|
||||
buffer[0] = byte(fileEntry.StorageType)<<4 + byte(len(fileEntry.FileName))
|
||||
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)
|
||||
_, err := writer.WriteAt(buffer, int64(fileEntry.DirectoryBlock)*512+int64(fileEntry.DirectoryOffset))
|
||||
if err != nil {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseVolumeHeader(buffer []byte) VolumeHeader {
|
||||
|
@ -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
|
||||
// license that can be found in the LICENSE 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
|
||||
// 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
|
||||
}
|
||||
|
||||
writeFileEntry(readerWriter, fileEntry)
|
||||
|
||||
err = writeFileEntry(readerWriter, fileEntry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return incrementFileCount(readerWriter, fileEntry)
|
||||
}
|
||||
|
||||
@ -168,7 +170,10 @@ func DeleteFile(readerWriter ReaderWriterAt, path string) error {
|
||||
// zero out directory entry
|
||||
fileEntry.StorageType = 0
|
||||
fileEntry.FileName = ""
|
||||
writeFileEntry(readerWriter, fileEntry)
|
||||
err = writeFileEntry(readerWriter, fileEntry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -422,7 +427,7 @@ func GetFileEntry(reader io.ReaderAt, path string) (FileEntry, error) {
|
||||
return FileEntry{}, err
|
||||
}
|
||||
|
||||
if fileEntries == nil || len(fileEntries) == 0 {
|
||||
if len(fileEntries) == 0 {
|
||||
return FileEntry{}, errors.New("file entry not found")
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -28,6 +28,9 @@ func AddFilesFromHostDirectory(
|
||||
) error {
|
||||
|
||||
path, err := makeFullPath(path, readerWriter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(path, "/") {
|
||||
path = path + "/"
|
||||
|
@ -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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE 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
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user