suppressed home component of disk path

This commit is contained in:
Denis Molony
2019-01-27 07:06:13 +11:00
parent 25948ad218
commit 1be511daeb
10 changed files with 39 additions and 16 deletions

View File

@@ -166,7 +166,7 @@ public class CPMDisk extends AbstractFormattedDisk
"---- --------- --- - - -- -- -- -- ----------------------------" "---- --------- --- - - -- -- -- -- ----------------------------"
+ "-------------------" + newLine; + "-------------------" + newLine;
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
text.append (String.format ("Disk : %s%n%n", getAbsolutePath ())); text.append (String.format ("Disk : %s%n%n", getDisplayPath ()));
text.append ("User Name Typ R S Ex S2 S1 RC Blocks" + newLine); text.append ("User Name Typ R S Ex S2 S1 RC Blocks" + newLine);
text.append (line); text.append (line);

View File

@@ -193,6 +193,18 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return disk.getFile ().getAbsolutePath (); return disk.getFile ().getAbsolutePath ();
} }
@Override
public String getDisplayPath ()
{
if (originalPath != null)
return originalPath.toString ();
String home = System.getProperty ("user.home");
String path = disk.getFile ().getAbsolutePath ();
if (path.startsWith (home))
return "~" + path.substring (home.length ());
return disk.getFile ().getAbsolutePath ();
}
@Override @Override
public String getName () public String getName ()
{ {

View File

@@ -119,7 +119,8 @@ public abstract class AbstractSector implements DataSource
if (size == 1) if (size == 1)
desc += " (" + (b[offset] & 0xFF) + ")"; desc += " (" + (b[offset] & 0xFF) + ")";
else if (size == 2) else if (size == 2)
desc += " (" + ((b[offset + 1] & 0xFF) * 256 + (b[offset] & 0xFF)) + ")"; desc +=
String.format (" (%,d)", ((b[offset + 1] & 0xFF) * 256 + (b[offset] & 0xFF)));
else if (size == 3) else if (size == 3)
desc += String.format (" (%,d)", ((b[offset + 2] & 0xFF) * 65536) desc += String.format (" (%,d)", ((b[offset + 2] & 0xFF) * 65536)
+ ((b[offset + 1] & 0xFF) * 256) + (b[offset] & 0xFF)); + ((b[offset + 1] & 0xFF) * 256) + (b[offset] & 0xFF));

View File

@@ -229,6 +229,12 @@ public class DualDosDisk implements FormattedDisk
return disks[currentDisk].getAbsolutePath (); return disks[currentDisk].getAbsolutePath ();
} }
@Override
public String getDisplayPath ()
{
return disks[currentDisk].getDisplayPath ();
}
@Override @Override
public FormattedDisk getParent () public FormattedDisk getParent ()
{ {

View File

@@ -64,6 +64,8 @@ public interface FormattedDisk
public String getAbsolutePath (); public String getAbsolutePath ();
public String getDisplayPath ();
public void setOriginalPath (Path path); public void setOriginalPath (Path path);
// VTOC flags sector as free, but it is in use by a file // VTOC flags sector as free, but it is in use by a file

View File

@@ -143,10 +143,9 @@ class CatalogEntry extends AbstractCatalogEntry
if (dataSectors.size () == 0) if (dataSectors.size () == 0)
message += "No data "; message += "No data ";
String text = String text = String.format ("%1s %1s %03d %-30.30s %-5s %-13s %3d %3d %s",
String.format ("%1s %1s %03d %-30.30s %-5s " + "%-13s %2d %3d %s", lockedFlag, getFileType (), actualSize, name, addressText, lengthText,
lockedFlag, getFileType (), actualSize, name, addressText, lengthText, tsSectors.size (), (dataSectors.size () - textFileGaps), message.trim ());
tsSectors.size (), (dataSectors.size () - textFileGaps), message.trim ());
if (actualSize == 0) if (actualSize == 0)
text = text.substring (0, 50); text = text.substring (0, 50);

View File

@@ -404,7 +404,7 @@ public class DosDisk extends AbstractFormattedDisk
String line = "- --- --- ------------------------------ ----- -------------" String line = "- --- --- ------------------------------ ----- -------------"
+ " -- ---- -------------------" + newLine; + " -- ---- -------------------" + newLine;
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
text.append (String.format ("Disk : %s%n%n", getAbsolutePath ())); text.append (String.format ("Disk : %s%n%n", getDisplayPath ()));
text.append ("L Typ Len Name Addr" text.append ("L Typ Len Name Addr"
+ " Length TS Data Comment" + newLine); + " Length TS Data Comment" + newLine);
text.append (line); text.append (line);

View File

@@ -11,8 +11,11 @@ import com.bytezone.diskbrowser.utilities.Utility;
public class WozFile public class WozFile
{ {
private static final byte[] WOZ_FILE_HEADER = private static final byte[] WOZ1_FILE_HEADER =
{ 0x57, 0x4F, 0x5A, 0x31, (byte) 0xFF, 0x0a, 0x0D, 0x0A }; { 0x57, 0x4F, 0x5A, 0x31, (byte) 0xFF, 0x0A, 0x0D, 0x0A };
private static final byte[] WOZ2_FILE_HEADER =
{ 0x57, 0x4F, 0x5A, 0x32, (byte) 0xFF, 0x0A, 0x0D, 0x0A };
private static final int TRK_SIZE = 0x1A00; private static final int TRK_SIZE = 0x1A00;
private static final int INFO_SIZE = 0x3C; private static final int INFO_SIZE = 0x3C;
private static final int TMAP_SIZE = 0xA0; private static final int TMAP_SIZE = 0xA0;
@@ -37,7 +40,7 @@ public class WozFile
byte[] buffer = readFile (); byte[] buffer = readFile ();
boolean valid = false; boolean valid = false;
if (!matches (WOZ_FILE_HEADER, buffer)) if (!matches (WOZ1_FILE_HEADER, buffer))
throw new DiskNibbleException ("Header error"); throw new DiskNibbleException ("Header error");
int checksum1 = readInt (buffer, 8, 4); int checksum1 = readInt (buffer, 8, 4);

View File

@@ -257,7 +257,7 @@ public class PascalDisk extends AbstractFormattedDisk
String date = String date =
volumeEntry.date == null ? "--" : df.format (volumeEntry.date.getTime ()); volumeEntry.date == null ? "--" : df.format (volumeEntry.date.getTime ());
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
text.append ("Disk : " + disk.getFile ().getAbsolutePath () + newLine2); text.append ("Disk : " + getDisplayPath () + newLine2);
text.append ("Volume : " + volumeEntry.name + newLine); text.append ("Volume : " + volumeEntry.name + newLine);
text.append ("Date : " + date + newLine2); text.append ("Date : " + date + newLine2);
text.append ( text.append (

View File

@@ -32,7 +32,7 @@ class ProdosDirectory extends AbstractFile implements ProdosConstants
public String getText () public String getText ()
{ {
StringBuffer text = new StringBuffer (); StringBuffer text = new StringBuffer ();
text.append ("Disk : " + parentFD.getAbsolutePath () + newLine2); text.append ("Disk : " + parentFD.getDisplayPath () + newLine2);
for (int i = 0; i < buffer.length; i += 39) for (int i = 0; i < buffer.length; i += 39)
{ {
int storageType = (buffer[i] & 0xF0) >> 4; int storageType = (buffer[i] & 0xF0) >> 4;