mirror of
https://github.com/softwarejanitor/ProDOS.git
synced 2024-05-29 02:41:31 +00:00
Fixes for writing files & deleting files.
This commit is contained in:
parent
cf9c0a081b
commit
f099afd649
17
ProDOS.pm
17
ProDOS.pm
|
@ -1675,6 +1675,8 @@ sub write_file {
|
||||||
# Read & rewrite the file descriptive entry out.
|
# Read & rewrite the file descriptive entry out.
|
||||||
my $dirbuf;
|
my $dirbuf;
|
||||||
|
|
||||||
|
$header_pointer = 2 if $header_pointer == 0;
|
||||||
|
|
||||||
if (read_blk($pofile, $header_pointer, \$dirbuf)) {
|
if (read_blk($pofile, $header_pointer, \$dirbuf)) {
|
||||||
dump_blk($dirbuf) if $debug;
|
dump_blk($dirbuf) if $debug;
|
||||||
dump_blk($dirbuf);
|
dump_blk($dirbuf);
|
||||||
|
@ -1949,12 +1951,12 @@ sub delete_file {
|
||||||
#printf("storage_type=\$%02x\n", $storage_type);
|
#printf("storage_type=\$%02x\n", $storage_type);
|
||||||
|
|
||||||
if ($storage_type == 0x0f || $storage_type == 0x0e) {
|
if ($storage_type == 0x0f || $storage_type == 0x0e) {
|
||||||
my $file_storage_type = $bytes[0x2b + ($i* 0x27)];
|
my $file_storage_type = $bytes[0x2b + ($i * 0x27)];
|
||||||
#printf("file_storage_type=\$%02x\n", $file_storage_type);
|
printf("file_storage_type=\$%02x\n", $file_storage_type);
|
||||||
$file_storage_type &= 0xf0;
|
$file_storage_type &= 0xf0;
|
||||||
#printf("file_storage_type=\$%02x\n", $file_storage_type);
|
printf("file_storage_type=\$%02x\n", $file_storage_type);
|
||||||
$bytes[0x2b + ($i* 0x27)] = 0x00;
|
$bytes[0x2b + ($i * 0x27)] = 0x00;
|
||||||
#printf("file_storage_type=\$%02x\n", $file_storage_type);
|
printf("file_storage_type=\$%02x\n", $file_storage_type);
|
||||||
|
|
||||||
# Now free all the blocks
|
# Now free all the blocks
|
||||||
if ($file_storage_type == 0x10) {
|
if ($file_storage_type == 0x10) {
|
||||||
|
@ -2024,16 +2026,21 @@ sub delete_file {
|
||||||
|
|
||||||
$buf = pack "C*", @bytes;
|
$buf = pack "C*", @bytes;
|
||||||
|
|
||||||
|
#dump_blk($buf) if $debug;
|
||||||
dump_blk($buf) if $debug;
|
dump_blk($buf) if $debug;
|
||||||
|
|
||||||
# Write the directory back out.
|
# Write the directory back out.
|
||||||
if (!write_blk($pofile, $header_pointer, \$buf)) {
|
if (!write_blk($pofile, $header_pointer, \$buf)) {
|
||||||
|
print "I/O Error writing block $header_pointer\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
print "I/O Error reading block $header_pointer\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "File deleted\n";
|
||||||
|
|
||||||
return $rv;
|
return $rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user