mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-02 19:29:17 +00:00
Minor simplification of getEntry() and getFiles() in ac.java.
This commit is contained in:
parent
a2622bf1e7
commit
82cfbef908
@ -2,7 +2,7 @@
|
|||||||
* ac - an AppleCommander command line utility
|
* ac - an AppleCommander command line utility
|
||||||
* Copyright (C) 2002 by Robert Greene
|
* Copyright (C) 2002 by Robert Greene
|
||||||
* robgreene at users.sourceforge.net
|
* robgreene at users.sourceforge.net
|
||||||
* Copyright (C) 2003, 2004 by John B. Matthews
|
* Copyright (C) 2003, 2004 by John B. Matthews
|
||||||
* matthewsj at users.sourceforge.net
|
* matthewsj at users.sourceforge.net
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@ -231,8 +231,8 @@ public class ac {
|
|||||||
Disk disk = new Disk(imageName);
|
Disk disk = new Disk(imageName);
|
||||||
if (directory.length() > 0) {
|
if (directory.length() > 0) {
|
||||||
// Add a final directory separator if the user didn't supply one
|
// Add a final directory separator if the user didn't supply one
|
||||||
if (!directory.endsWith(System.getProperty("file.separator")))
|
if (!directory.endsWith(File.separator))
|
||||||
directory = directory + System.getProperty("file.separator");
|
directory = directory + File.separator;
|
||||||
}
|
}
|
||||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||||
for (int i = 0; i < formattedDisks.length; i++) {
|
for (int i = 0; i < formattedDisks.length; i++) {
|
||||||
@ -262,18 +262,18 @@ public class ac {
|
|||||||
* file with the given filename.
|
* file with the given filename.
|
||||||
*/
|
*/
|
||||||
static FileEntry getEntry(List files, String fileName) {
|
static FileEntry getEntry(List files, String fileName) {
|
||||||
FileEntry theEntry = null;
|
FileEntry entry = null;
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (int i = 0; i < files.size(); i++) {
|
for (int i = 0; i < files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
entry = (FileEntry) files.get(i);
|
||||||
String entryName = entry.getFilename();
|
String entryName = entry.getFilename();
|
||||||
if (!entry.isDeleted() && fileName.equalsIgnoreCase(entryName)) {
|
if (!entry.isDeleted() && fileName.equalsIgnoreCase(entryName)) {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
theEntry = getEntry(((DirectoryEntry) entry).getFiles(), fileName);
|
entry = getEntry(((DirectoryEntry) entry).getFiles(), fileName);
|
||||||
if (theEntry != null) {
|
if (entry != null) {
|
||||||
return theEntry;
|
return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user