mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-18 04:34:25 +00:00
Fixing a wrongly placed DiskException handler on the command line tool.
This commit is contained in:
parent
ae66b88e0a
commit
f3316262c8
@ -26,6 +26,7 @@ import java.io.PrintStream;
|
|||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
import org.apache.tools.ant.Task;
|
import org.apache.tools.ant.Task;
|
||||||
import com.webcodepro.applecommander.storage.Disk;
|
import com.webcodepro.applecommander.storage.Disk;
|
||||||
|
import com.webcodepro.applecommander.storage.DiskException;
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||||
|
|
||||||
public class AntTask extends Task
|
public class AntTask extends Task
|
||||||
@ -107,7 +108,7 @@ public class AntTask extends Task
|
|||||||
{
|
{
|
||||||
com.webcodepro.applecommander.ui.ac.deleteFile(_imageName, _fileName);
|
com.webcodepro.applecommander.ui.ac.deleteFile(_imageName, _fileName);
|
||||||
}
|
}
|
||||||
catch (IOException io)
|
catch (IOException|DiskException io)
|
||||||
{
|
{
|
||||||
if (_failonerror)
|
if (_failonerror)
|
||||||
throw new BuildException(io);
|
throw new BuildException(io);
|
||||||
@ -138,7 +139,7 @@ public class AntTask extends Task
|
|||||||
else // Assume unlock
|
else // Assume unlock
|
||||||
com.webcodepro.applecommander.ui.ac.setFileLocked(_imageName, _fileName, false);
|
com.webcodepro.applecommander.ui.ac.setFileLocked(_imageName, _fileName, false);
|
||||||
}
|
}
|
||||||
catch (IOException io)
|
catch (IOException|DiskException io)
|
||||||
{
|
{
|
||||||
if (_failonerror)
|
if (_failonerror)
|
||||||
throw new BuildException(io);
|
throw new BuildException(io);
|
||||||
|
@ -264,7 +264,7 @@ public class ac {
|
|||||||
* Delete the file named fileName from the disk named imageName.
|
* Delete the file named fileName from the disk named imageName.
|
||||||
*/
|
*/
|
||||||
static void deleteFile(String imageName, String fileName)
|
static void deleteFile(String imageName, String fileName)
|
||||||
throws IOException {
|
throws IOException, DiskException {
|
||||||
Disk disk = new Disk(imageName);
|
Disk disk = new Disk(imageName);
|
||||||
Name name = new Name(fileName);
|
Name name = new Name(fileName);
|
||||||
if (!disk.isSDK() && !disk.isDC42()) {
|
if (!disk.isSDK() && !disk.isDC42()) {
|
||||||
@ -290,7 +290,7 @@ public class ac {
|
|||||||
* filtered according to its type and sent to <stdout>.
|
* filtered according to its type and sent to <stdout>.
|
||||||
*/
|
*/
|
||||||
static void getFile(String imageName, String fileName, boolean filter, PrintStream out)
|
static void getFile(String imageName, String fileName, boolean filter, PrintStream out)
|
||||||
throws IOException {
|
throws IOException, DiskException {
|
||||||
Disk disk = new Disk(imageName);
|
Disk disk = new Disk(imageName);
|
||||||
Name name = new Name(fileName);
|
Name name = new Name(fileName);
|
||||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||||
@ -479,7 +479,7 @@ public class ac {
|
|||||||
* Set the lockState of the file named fileName on the disk named imageName.
|
* Set the lockState of the file named fileName on the disk named imageName.
|
||||||
* Proposed by David Schmidt.
|
* Proposed by David Schmidt.
|
||||||
*/
|
*/
|
||||||
public static void setFileLocked(String imageName, String name, boolean lockState) throws IOException {
|
public static void setFileLocked(String imageName, String name, boolean lockState) throws IOException, DiskException {
|
||||||
setFileLocked(imageName, new Name(name), lockState);
|
setFileLocked(imageName, new Name(name), lockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ public class ac {
|
|||||||
* Proposed by David Schmidt.
|
* Proposed by David Schmidt.
|
||||||
*/
|
*/
|
||||||
static void setFileLocked(String imageName, Name name,
|
static void setFileLocked(String imageName, Name name,
|
||||||
boolean lockState) throws IOException {
|
boolean lockState) throws IOException, DiskException {
|
||||||
Disk disk = new Disk(imageName);
|
Disk disk = new Disk(imageName);
|
||||||
if (!disk.isSDK() && !disk.isDC42()) {
|
if (!disk.isSDK() && !disk.isDC42()) {
|
||||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||||
@ -620,29 +620,25 @@ public class ac {
|
|||||||
this.name = path[path.length - 1];
|
this.name = path[path.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileEntry getEntry(FormattedDisk formattedDisk) {
|
public FileEntry getEntry(FormattedDisk formattedDisk) throws DiskException {
|
||||||
try {
|
List files = formattedDisk.getFiles();
|
||||||
List files = formattedDisk.getFiles();
|
FileEntry entry = null;
|
||||||
FileEntry entry = null;
|
for (int i = 0; i < path.length - 1; i++) {
|
||||||
for (int i = 0; i < path.length - 1; i++) {
|
String dirName = path[i];
|
||||||
String dirName = path[i];
|
for (int j = 0; j < files.size(); j++) {
|
||||||
for (int j = 0; j < files.size(); j++) {
|
entry = (FileEntry) files.get(j);
|
||||||
entry = (FileEntry) files.get(j);
|
|
||||||
String entryName = entry.getFilename();
|
|
||||||
if (entry.isDirectory() && dirName.equalsIgnoreCase(entryName)) {
|
|
||||||
files = ((DirectoryEntry) entry).getFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < files.size(); i++) {
|
|
||||||
entry = (FileEntry) files.get(i);
|
|
||||||
String entryName = entry.getFilename();
|
String entryName = entry.getFilename();
|
||||||
if (!entry.isDeleted() && name.equalsIgnoreCase(entryName)) {
|
if (entry.isDirectory() && dirName.equalsIgnoreCase(entryName)) {
|
||||||
return entry;
|
files = ((DirectoryEntry) entry).getFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DiskException e) {
|
}
|
||||||
// FIXME How to warn user about the problem?
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
entry = (FileEntry) files.get(i);
|
||||||
|
String entryName = entry.getFilename();
|
||||||
|
if (!entry.isDeleted() && name.equalsIgnoreCase(entryName)) {
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user