rename tmp files

This commit is contained in:
Denis Molony 2021-04-19 09:53:37 +10:00
parent e6100d247a
commit 373e8d29a3
9 changed files with 25 additions and 20 deletions

View File

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

View File

@ -67,6 +67,7 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
*/
sectorTypesList.add (emptySector);
sectorTypesList.add (usedSector);
/*
* Hopefully every used sector will be changed by the subclass to something
* sensible, but deleted files will always leave the sector as used/unknown
@ -74,16 +75,22 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
*/
setSectorTypes ();
setGridLayout ();
/*
* Create the disk name as the root for the catalog tree. Subclasses will
* have to append their catalog entries to this node.
*/
String name = getName ();
if (name.endsWith (".tmp"))
name = "tmp.dsk";
DefaultAppleFileSource afs =
new DefaultAppleFileSource (getName (), disk.toString (), this);
new DefaultAppleFileSource (name, disk.toString (), this);
DefaultMutableTreeNode root = new DefaultMutableTreeNode (afs);
DefaultTreeModel treeModel = new DefaultTreeModel (root);
catalogTree = new JTree (treeModel);
treeModel.setAsksAllowsChildren (true); // allows empty nodes to appear as folders
/*
* Add an ActionListener to the disk in case the interleave or blocksize
* changes
@ -226,11 +233,13 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
public String getDisplayPath ()
// ---------------------------------------------------------------------------------//
{
if (originalPath != null)
return originalPath.toString ();
// if (originalPath != null)
// return originalPath.toString ();
String home = System.getProperty ("user.home");
String path = disk.getFile ().getAbsolutePath ();
String path = originalPath != null ? originalPath.toString ()
: disk.getFile ().getAbsolutePath ();
if (path.startsWith (home))
return "~" + path.substring (home.length ());

View File

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

View File

@ -17,8 +17,8 @@ import javax.swing.tree.TreeNode;
import com.bytezone.diskbrowser.applefile.AppleFileSource;
import com.bytezone.diskbrowser.disk.DiskFactory;
import com.bytezone.diskbrowser.disk.HybridDisk;
import com.bytezone.diskbrowser.disk.FormattedDisk;
import com.bytezone.diskbrowser.disk.HybridDisk;
import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
// -----------------------------------------------------------------------------------//
@ -59,7 +59,7 @@ class AppleDiskTab extends AbstractTab
// ---------------------------------------------------------------------------------//
{
super (redoHandler, selector, font);
// System.out.println ("File not found: " + lastFileUsed);
create (disk);
DefaultMutableTreeNode node = findNode (lastFileUsed);
@ -101,7 +101,6 @@ class AppleDiskTab extends AbstractTab
public void activate ()
// ---------------------------------------------------------------------------------//
{
// System.out.println ("=========== Activating AppleDiskTab =============");
eventHandler.redo = true;
eventHandler.fireDiskSelectionEvent (disk);
eventHandler.redo = false;

View File

@ -107,18 +107,16 @@ class TreeBuilder
System.out.println ("Failed to set the disk icon : " + iconName);
}
/*
* Class used to control the text displayed by the JTree.
*/
// ---------------------------------------------------------------------------------//
class FileNode implements DataSource // why does it implement DataSource?
// ---------------------------------------------------------------------------------//
{
DefaultMutableTreeNode parentNode;
public final File file;
private static final int MAX_NAME_LENGTH = 36;
private static final int SUFFIX_LENGTH = 12;
private static final int PREFIX_LENGTH = MAX_NAME_LENGTH - SUFFIX_LENGTH - 3;
DefaultMutableTreeNode parentNode;
public final File file;
private FormattedDisk formattedDisk;
int disks;
boolean showDisks;

View File

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

View File

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

View File

@ -7,10 +7,6 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.gui.DataSource;
import com.bytezone.diskbrowser.utilities.Utility;
/*
* There is only one of these - it is always the first entry in the first block.
* Every other entry will be either a SubDirectoryHeader or a FileEntry.
*/
// -----------------------------------------------------------------------------------//
class VolumeDirectoryHeader extends DirectoryHeader
// -----------------------------------------------------------------------------------//

View File

@ -66,6 +66,8 @@ public class NuFX
if (record.hasFile ())
{
++totalFiles;
// note: total blocks does not include subdirectory blocks
int blocks = (record.getFileSize () - 1) / 512 + 1;
if (blocks == 1) // seedling
totalBlocks += blocks;
@ -73,6 +75,7 @@ public class NuFX
totalBlocks += blocks + 1;
else // tree
totalBlocks += blocks + (blocks / 256) + 2;
storePath (record.getFileName ());
}