rename tmp files
This commit is contained in:
parent
e6100d247a
commit
373e8d29a3
|
@ -185,7 +185,7 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||||
"---- --------- --- - - -- -- -- -- ----------------------------"
|
"---- --------- --- - - -- -- -- -- ----------------------------"
|
||||||
+ "-------------------" + newLine;
|
+ "-------------------" + newLine;
|
||||||
StringBuilder text = new StringBuilder ();
|
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 ("User Name Typ R S Ex S2 S1 RC Blocks" + newLine);
|
||||||
text.append (line);
|
text.append (line);
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
*/
|
*/
|
||||||
sectorTypesList.add (emptySector);
|
sectorTypesList.add (emptySector);
|
||||||
sectorTypesList.add (usedSector);
|
sectorTypesList.add (usedSector);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hopefully every used sector will be changed by the subclass to something
|
* Hopefully every used sector will be changed by the subclass to something
|
||||||
* sensible, but deleted files will always leave the sector as used/unknown
|
* sensible, but deleted files will always leave the sector as used/unknown
|
||||||
|
@ -74,16 +75,22 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
*/
|
*/
|
||||||
setSectorTypes ();
|
setSectorTypes ();
|
||||||
setGridLayout ();
|
setGridLayout ();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the disk name as the root for the catalog tree. Subclasses will
|
* Create the disk name as the root for the catalog tree. Subclasses will
|
||||||
* have to append their catalog entries to this node.
|
* have to append their catalog entries to this node.
|
||||||
*/
|
*/
|
||||||
|
String name = getName ();
|
||||||
|
if (name.endsWith (".tmp"))
|
||||||
|
name = "tmp.dsk";
|
||||||
|
|
||||||
DefaultAppleFileSource afs =
|
DefaultAppleFileSource afs =
|
||||||
new DefaultAppleFileSource (getName (), disk.toString (), this);
|
new DefaultAppleFileSource (name, disk.toString (), this);
|
||||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode (afs);
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode (afs);
|
||||||
DefaultTreeModel treeModel = new DefaultTreeModel (root);
|
DefaultTreeModel treeModel = new DefaultTreeModel (root);
|
||||||
catalogTree = new JTree (treeModel);
|
catalogTree = new JTree (treeModel);
|
||||||
treeModel.setAsksAllowsChildren (true); // allows empty nodes to appear as folders
|
treeModel.setAsksAllowsChildren (true); // allows empty nodes to appear as folders
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add an ActionListener to the disk in case the interleave or blocksize
|
* Add an ActionListener to the disk in case the interleave or blocksize
|
||||||
* changes
|
* changes
|
||||||
|
@ -226,11 +233,13 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
|
||||||
public String getDisplayPath ()
|
public String getDisplayPath ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (originalPath != null)
|
// if (originalPath != null)
|
||||||
return originalPath.toString ();
|
// return originalPath.toString ();
|
||||||
|
|
||||||
String home = System.getProperty ("user.home");
|
String home = System.getProperty ("user.home");
|
||||||
String path = disk.getFile ().getAbsolutePath ();
|
|
||||||
|
String path = originalPath != null ? originalPath.toString ()
|
||||||
|
: disk.getFile ().getAbsolutePath ();
|
||||||
if (path.startsWith (home))
|
if (path.startsWith (home))
|
||||||
return "~" + path.substring (home.length ());
|
return "~" + path.substring (home.length ());
|
||||||
|
|
||||||
|
|
|
@ -532,7 +532,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||||
|
|
||||||
StringBuilder text = new StringBuilder ();
|
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"
|
text.append ("L Typ Len Name Addr"
|
||||||
+ " Length TS Data Comment" + newLine);
|
+ " Length TS Data Comment" + newLine);
|
||||||
text.append (underline);
|
text.append (underline);
|
||||||
|
|
|
@ -17,8 +17,8 @@ import javax.swing.tree.TreeNode;
|
||||||
|
|
||||||
import com.bytezone.diskbrowser.applefile.AppleFileSource;
|
import com.bytezone.diskbrowser.applefile.AppleFileSource;
|
||||||
import com.bytezone.diskbrowser.disk.DiskFactory;
|
import com.bytezone.diskbrowser.disk.DiskFactory;
|
||||||
import com.bytezone.diskbrowser.disk.HybridDisk;
|
|
||||||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||||
|
import com.bytezone.diskbrowser.disk.HybridDisk;
|
||||||
import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
|
import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
|
@ -59,7 +59,7 @@ class AppleDiskTab extends AbstractTab
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (redoHandler, selector, font);
|
super (redoHandler, selector, font);
|
||||||
// System.out.println ("File not found: " + lastFileUsed);
|
|
||||||
create (disk);
|
create (disk);
|
||||||
|
|
||||||
DefaultMutableTreeNode node = findNode (lastFileUsed);
|
DefaultMutableTreeNode node = findNode (lastFileUsed);
|
||||||
|
@ -101,7 +101,6 @@ class AppleDiskTab extends AbstractTab
|
||||||
public void activate ()
|
public void activate ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
// System.out.println ("=========== Activating AppleDiskTab =============");
|
|
||||||
eventHandler.redo = true;
|
eventHandler.redo = true;
|
||||||
eventHandler.fireDiskSelectionEvent (disk);
|
eventHandler.fireDiskSelectionEvent (disk);
|
||||||
eventHandler.redo = false;
|
eventHandler.redo = false;
|
||||||
|
|
|
@ -107,18 +107,16 @@ class TreeBuilder
|
||||||
System.out.println ("Failed to set the disk icon : " + iconName);
|
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?
|
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 MAX_NAME_LENGTH = 36;
|
||||||
private static final int SUFFIX_LENGTH = 12;
|
private static final int SUFFIX_LENGTH = 12;
|
||||||
private static final int PREFIX_LENGTH = MAX_NAME_LENGTH - SUFFIX_LENGTH - 3;
|
private static final int PREFIX_LENGTH = MAX_NAME_LENGTH - SUFFIX_LENGTH - 3;
|
||||||
|
|
||||||
|
DefaultMutableTreeNode parentNode;
|
||||||
|
public final File file;
|
||||||
private FormattedDisk formattedDisk;
|
private FormattedDisk formattedDisk;
|
||||||
int disks;
|
int disks;
|
||||||
boolean showDisks;
|
boolean showDisks;
|
||||||
|
|
|
@ -282,7 +282,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 : " + getDisplayPath () + newLine2);
|
text.append ("File : " + 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 (
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ProdosDirectory extends AbstractFile implements ProdosConstants
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuffer text = new StringBuffer ();
|
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)
|
for (int i = 0; i < buffer.length; i += ENTRY_SIZE)
|
||||||
{
|
{
|
||||||
int storageType = (buffer[i] & 0xF0) >> 4;
|
int storageType = (buffer[i] & 0xF0) >> 4;
|
||||||
|
|
|
@ -7,10 +7,6 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||||
import com.bytezone.diskbrowser.gui.DataSource;
|
import com.bytezone.diskbrowser.gui.DataSource;
|
||||||
import com.bytezone.diskbrowser.utilities.Utility;
|
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
|
class VolumeDirectoryHeader extends DirectoryHeader
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
|
|
|
@ -66,6 +66,8 @@ public class NuFX
|
||||||
if (record.hasFile ())
|
if (record.hasFile ())
|
||||||
{
|
{
|
||||||
++totalFiles;
|
++totalFiles;
|
||||||
|
|
||||||
|
// note: total blocks does not include subdirectory blocks
|
||||||
int blocks = (record.getFileSize () - 1) / 512 + 1;
|
int blocks = (record.getFileSize () - 1) / 512 + 1;
|
||||||
if (blocks == 1) // seedling
|
if (blocks == 1) // seedling
|
||||||
totalBlocks += blocks;
|
totalBlocks += blocks;
|
||||||
|
@ -73,6 +75,7 @@ public class NuFX
|
||||||
totalBlocks += blocks + 1;
|
totalBlocks += blocks + 1;
|
||||||
else // tree
|
else // tree
|
||||||
totalBlocks += blocks + (blocks / 256) + 2;
|
totalBlocks += blocks + (blocks / 256) + 2;
|
||||||
|
|
||||||
storePath (record.getFileName ());
|
storePath (record.getFileName ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue