mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-12-01 09:50:32 +00:00
better empty file handling
This commit is contained in:
parent
1b57001315
commit
080cafcd22
@ -60,8 +60,7 @@ abstract class CatalogEntry implements AppleFileSource
|
||||
public List<DiskAddress> getSectors ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
List<DiskAddress> sectors = new ArrayList<> (blocks);
|
||||
return sectors;
|
||||
return new ArrayList<> (blocks); // make a copy
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -61,16 +61,19 @@ public class FileEntry extends CatalogEntry
|
||||
public AbstractFile getDataSource ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (file != null)
|
||||
if (file != null) // previously built
|
||||
return file;
|
||||
|
||||
byte[] buffer = getExactBuffer ();
|
||||
if (buffer.length == 0)
|
||||
// check for empty file (e.g. see DC16.dsk)
|
||||
if (firstBlock == lastBlock)
|
||||
{
|
||||
file = new AssemblerProgram (name, buffer, 0); // see DC16.dsk
|
||||
file = new DefaultAppleFile (name, new byte[0]);
|
||||
node.setAllowsChildren (false);
|
||||
return file;
|
||||
}
|
||||
|
||||
byte[] buffer = getExactBuffer ();
|
||||
|
||||
switch (fileType)
|
||||
{
|
||||
case 2: // code (6502 or Pascal)
|
||||
|
@ -22,6 +22,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
import com.bytezone.diskbrowser.wizardry.Relocator;
|
||||
|
||||
// useful : http://pascal.hansotten.com/ucsd-p-system/apple-pascal/apple-ii/
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class PascalDisk extends AbstractFormattedDisk
|
||||
// -----------------------------------------------------------------------------------//
|
||||
|
Loading…
Reference in New Issue
Block a user