mirror of
https://github.com/tjboldt/ProDOS-Utilities.git
synced 2024-12-27 05:29:49 +00:00
Fix putall to not erase volume (#15)
This commit is contained in:
parent
4ed23e0e6f
commit
592f3a6542
4
main.go
4
main.go
@ -17,7 +17,7 @@ import (
|
||||
"github.com/tjboldt/ProDOS-Utilities/prodos"
|
||||
)
|
||||
|
||||
const version = "0.4.0"
|
||||
const version = "0.4.1"
|
||||
|
||||
func main() {
|
||||
var fileName string
|
||||
@ -155,7 +155,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
err = prodos.AddFilesFromHostDirectory(file, inFileName, volumeName, volumeSize)
|
||||
err = prodos.AddFilesFromHostDirectory(file, inFileName)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to add host files: %s\n", err)
|
||||
return
|
||||
|
@ -164,6 +164,7 @@ func ConvertBasicToText(basic []byte) string {
|
||||
}
|
||||
}
|
||||
|
||||
// ConvertTextToBasic converts text to AppleSoft BASIC
|
||||
func ConvertTextToBasic(text string) ([]byte, error) {
|
||||
// convert line endings
|
||||
text = strings.Replace(text, "\r\n", "\n", -1)
|
||||
|
@ -426,6 +426,7 @@ func createBlockList(reader io.ReaderAt, fileSize int) ([]int, error) {
|
||||
return blockList, nil
|
||||
}
|
||||
|
||||
// GetFileEntry returns a file entry for the given path
|
||||
func GetFileEntry(reader io.ReaderAt, path string) (FileEntry, error) {
|
||||
directory, fileName := GetDirectoryAndFileNameFromPath(path)
|
||||
_, _, fileEntries, err := ReadDirectory(reader, directory)
|
||||
|
@ -15,10 +15,7 @@ import (
|
||||
// from the specified host directory
|
||||
func AddFilesFromHostDirectory(
|
||||
readerWriter ReaderWriterAt,
|
||||
directory string,
|
||||
volumeName string,
|
||||
numberOfBlocks int) error {
|
||||
CreateVolume(readerWriter, volumeName, numberOfBlocks)
|
||||
directory string) error {
|
||||
|
||||
files, err := os.ReadDir(directory)
|
||||
if err != nil {
|
||||
|
@ -12,6 +12,7 @@ type MemoryFile struct {
|
||||
size int
|
||||
}
|
||||
|
||||
// ReaderWriterAt is an interface for both ReaderAt and WriterAt combined
|
||||
type ReaderWriterAt interface {
|
||||
ReadAt(data []byte, offset int64) (int, error)
|
||||
WriteAt(data []byte, offset int64) (int, error)
|
||||
|
Loading…
Reference in New Issue
Block a user