mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-09-29 00:55:53 +00:00
Bug fix: DosFormatDisk.createFile() must iterate sectors (not tracks); in ac.putFile() call setFileData() _then_ setAddress().
This commit is contained in:
parent
713bfac5f2
commit
c4ef209792
@ -357,6 +357,8 @@ public class DosFileEntry implements FileEntry {
|
|||||||
* Note: The address can be set before the data is saved or
|
* Note: The address can be set before the data is saved or
|
||||||
* after the data is saved. This is an attempt to make the
|
* after the data is saved. This is an attempt to make the
|
||||||
* API more easily usable.
|
* API more easily usable.
|
||||||
|
*
|
||||||
|
* Empirically, the data must be set before the address is set.
|
||||||
*/
|
*/
|
||||||
public void setFileData(byte[] data) throws DiskFullException {
|
public void setFileData(byte[] data) throws DiskFullException {
|
||||||
if (isBinaryFile()) {
|
if (isBinaryFile()) {
|
||||||
|
@ -161,7 +161,7 @@ public class DosFormatDisk extends FormattedDisk {
|
|||||||
byte[] vtoc = readVtoc();
|
byte[] vtoc = readVtoc();
|
||||||
int track = AppleUtil.getUnsignedByte(vtoc[1]);
|
int track = AppleUtil.getUnsignedByte(vtoc[1]);
|
||||||
int sector = AppleUtil.getUnsignedByte(vtoc[2]);
|
int sector = AppleUtil.getUnsignedByte(vtoc[2]);
|
||||||
while (track != 0) { // iterate through all catalog sectors
|
while (sector != 0) { // bug fix: iterate through all catalog _sectors_
|
||||||
byte[] catalogSector = readSector(track, sector);
|
byte[] catalogSector = readSector(track, sector);
|
||||||
int offset = 0x0b;
|
int offset = 0x0b;
|
||||||
while (offset < 0xff) { // iterate through all entries
|
while (offset < 0xff) { // iterate through all entries
|
||||||
|
@ -106,10 +106,10 @@ public class ac {
|
|||||||
FileEntry entry = formattedDisk.createFile();
|
FileEntry entry = formattedDisk.createFile();
|
||||||
entry.setFilename(fileName);
|
entry.setFilename(fileName);
|
||||||
entry.setFiletype(fileType);
|
entry.setFiletype(fileType);
|
||||||
|
entry.setFileData(buf.toByteArray());
|
||||||
if (entry.needsAddress()) {
|
if (entry.needsAddress()) {
|
||||||
entry.setAddress(stringToInt(address));
|
entry.setAddress(stringToInt(address));
|
||||||
}
|
}
|
||||||
entry.setFileData(buf.toByteArray());
|
|
||||||
formattedDisk.save();
|
formattedDisk.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user