From 4ab834300d3e0da0208d639528316543c8df426f Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Mon, 19 Apr 2021 12:46:45 +1000 Subject: [PATCH] use file name as volume name --- .../bytezone/diskbrowser/utilities/NuFX.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/com/bytezone/diskbrowser/utilities/NuFX.java b/src/com/bytezone/diskbrowser/utilities/NuFX.java index 6d3b6b2..49e35f3 100644 --- a/src/com/bytezone/diskbrowser/utilities/NuFX.java +++ b/src/com/bytezone/diskbrowser/utilities/NuFX.java @@ -24,13 +24,14 @@ public class NuFX private int totalDisks; private int totalBlocks; - private VolumeName volumeName = new VolumeName (); + private VolumeName volumeName; // ---------------------------------------------------------------------------------// public NuFX (Path path) throws FileFormatException, IOException // ---------------------------------------------------------------------------------// { buffer = Files.readAllBytes (path); + volumeName = new VolumeName (path); masterHeader = new MasterHeader (buffer); @@ -82,8 +83,6 @@ public class NuFX if (record.hasDisk ()) ++totalDisks; } - - // volumeName.info (); } // ---------------------------------------------------------------------------------// @@ -211,6 +210,18 @@ public class NuFX private String volumeName = "DiskBrowser"; private int nameOffset = 0; + // -------------------------------------------------------------------------------// + VolumeName (Path path) + // -------------------------------------------------------------------------------// + { + volumeName = path.getFileName ().toString (); + int pos = volumeName.lastIndexOf ('.'); + if (pos > 0) + volumeName = volumeName.substring (0, pos); + if (volumeName.length () > 15) + volumeName = volumeName.substring (0, 15); + } + // -------------------------------------------------------------------------------// private void storePath (String fileName) // -------------------------------------------------------------------------------// @@ -240,6 +251,9 @@ public class NuFX private String getVolumeName () // -------------------------------------------------------------------------------// { + if (true) + return volumeName; + if (rootContainsFiles) return volumeName;