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