From 2655db4da83261c7b9e13e417979e6a5e46ab82e Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Mon, 23 Jul 2018 17:39:25 +1000 Subject: [PATCH] tweaks --- .../diskbrowser/disk/DiskFactory.java | 3 +- .../diskbrowser/duplicates/DisksWindow.java | 2 +- .../duplicates/RootFolderData.java | 9 ++++ .../diskbrowser/prodos/FileEntry.java | 53 ------------------- .../prodos/VolumeDirectoryHeader.java | 3 +- 5 files changed, 14 insertions(+), 56 deletions(-) diff --git a/src/com/bytezone/diskbrowser/disk/DiskFactory.java b/src/com/bytezone/diskbrowser/disk/DiskFactory.java index bdcf2d9..6a6b314 100755 --- a/src/com/bytezone/diskbrowser/disk/DiskFactory.java +++ b/src/com/bytezone/diskbrowser/disk/DiskFactory.java @@ -567,7 +567,8 @@ public class DiskFactory } catch (Exception e) { - System.out.println (e); + e.printStackTrace (); + // System.out.println (e); } if (debug) System.out.println ("Not a Prodos 2mg disk"); diff --git a/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java b/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java index fe7c15c..4963b09 100644 --- a/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java +++ b/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java @@ -44,7 +44,7 @@ public class DisksWindow extends JFrame public DisksWindow (RootFolderData rootFolderData) { - super ("Disk List - " + rootFolderData.getRootFolder ().getAbsolutePath ()); + super (rootFolderData.getRootFolderPathText ()); this.rootFolderData = rootFolderData; table = new JTable (); diff --git a/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java b/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java index 65229a4..c5bb842 100644 --- a/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java +++ b/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java @@ -132,6 +132,15 @@ public class RootFolderData disksWindow = null; // force a recount } + String getRootFolderPathText () + { + String text = rootFolder.getAbsolutePath (); + String homeDir = System.getProperty ("user.home"); + if (text.startsWith (homeDir)) + text = text.replace (homeDir, "~"); + return text; + } + private void clear () { typeTotals = new int[4][Utility.suffixes.size ()]; diff --git a/src/com/bytezone/diskbrowser/prodos/FileEntry.java b/src/com/bytezone/diskbrowser/prodos/FileEntry.java index d121cec..d95239e 100755 --- a/src/com/bytezone/diskbrowser/prodos/FileEntry.java +++ b/src/com/bytezone/diskbrowser/prodos/FileEntry.java @@ -32,15 +32,11 @@ class FileEntry extends CatalogEntry implements ProdosConstants private boolean invalid; private FileEntry link; - // private final Disk appleDisk; - public FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent, int parentBlock) { super (fDisk, entryBuffer); - // appleDisk = fDisk.getDisk (); - assert parent != null; this.parentDirectory = parent; this.catalogBlock = this.disk.getDiskAddress (parentBlock); @@ -61,17 +57,11 @@ class FileEntry extends CatalogEntry implements ProdosConstants break; case SAPLING: - // if (isGSOSFile ()) // not sure why this exists - // traverseGEOSIndex (keyPtr); - // else addDataBlocks (storageType, keyPtr); break; case TREE: masterIndexBlock = disk.getDiskAddress (keyPtr); - // if (isGSOSFile ()) // not sure why this exists - // traverseGEOSMasterIndex (keyPtr); - // else addDataBlocks (storageType, keyPtr); break; @@ -203,49 +193,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants return blocks; } - // should be removed - // private boolean isGSOSFile () - // { - // // return ((fileType & 0xF0) == 0x80); - // if ((fileType & 0xF0) == 0x80) - // System.out.println ("GS/OS file: " + name); - // return false; - // } - - // should be removed - // private void traverseGEOSMasterIndex (int keyPtr) - // { - // byte[] buffer = disk.readSector (keyPtr); // master index - // for (int i = 0; i < 0x80; i++) - // { - // int block = HexFormatter.intValue (buffer[i], buffer[i + 256]); - // if (block == 0) - // break; - // if (block == 0xFFFF) - // continue; - // traverseGEOSIndex (block); - // } - // } - - // should be removed - // private void traverseGEOSIndex (int keyPtr) - // { - // parentDisk.setSectorType (keyPtr, parentDisk.indexSector); - // indexBlocks.add (disk.getDiskAddress (keyPtr)); - // byte[] buffer = disk.readSector (keyPtr); - // - // for (int i = 0; i < 0x80; i++) - // { - // int block = HexFormatter.intValue (buffer[i], buffer[i + 256]); - // if (block == 0) - // break; - // if (block == 0xFFFF) - // continue; - // parentDisk.setSectorType (block, parentDisk.dataSector); - // dataBlocks.add (disk.getDiskAddress (block)); - // } - // } - @Override public DataSource getDataSource () { diff --git a/src/com/bytezone/diskbrowser/prodos/VolumeDirectoryHeader.java b/src/com/bytezone/diskbrowser/prodos/VolumeDirectoryHeader.java index 0965378..e69cd15 100755 --- a/src/com/bytezone/diskbrowser/prodos/VolumeDirectoryHeader.java +++ b/src/com/bytezone/diskbrowser/prodos/VolumeDirectoryHeader.java @@ -40,7 +40,8 @@ class VolumeDirectoryHeader extends DirectoryHeader } while (block > 0); // convert the Free Sector Table - int bitMapBytes = totalBlocks / 8; // one bit per block + // int bitMapBytes = totalBlocks / 8; // one bit per block + int bitMapBytes = (totalBlocks - 1) / 8 + 1; // one bit per block byte[] buffer = new byte[bitMapBytes]; int bitMapBlocks = (bitMapBytes - 1) / disk.getSectorsPerTrack () + 1; int lastBitMapBlock = bitMapBlock + bitMapBlocks - 1;