home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
ZIPArchiver.java
< prev
next >
Wrap
Text File
|
1998-10-14
|
2KB
|
101 lines
package com.symantec.itools.tools.archive;
import java.io.File;
import java.io.IOException;
import com.symantec.itools.lang.Classpath;
import com.symantec.itools.lang.NotJavaNameException;
import com.symantec.itools.io.FileSystem;
import com.symantec.itools.lang.Debug;
import com.symantec.itools.lang.ProcessManager;
/**
* @author Symantec Internet Tools Division
* @version 1.0
* @since VCafe 3.0
*/
public class ZIPArchiver
extends TypeArchiver
{
/**
* @since VCafe 3.0
*/
protected ProcessManager processManager;
public ZIPArchiver(Options options)
{
super(options);
}
/**
* @param errorMsg TODO
* @since VCafe 3.0
*/
public boolean create(StringBuffer errorMsg)
{
return (createUsingSunJAR(errorMsg));
}
/**
* @param errorMsg TODO
* @since VCafe 3.0
*/
protected boolean createUsingSunJAR(StringBuffer errorMsg)
{
DirectoryArchiver archiver;
String outFile;
String manifestFile;
StringBuffer command;
String tempDir;
outFile = options.getOutputLocation();
tempDir = options.getTempDir();
options.setOutputLocation(tempDir);
archiver = new DirectoryArchiver(options);
manifestFile = null;
if(!(archiver.create(errorMsg)))
{
return (false);
}
options.setOutputLocation(outFile);
command = new StringBuffer(FileSystem.quoteIfNeeded(FileSystem.getCanonicalPath(options.getSunTools(), true) + "jar.exe"));
command.append(' ').append(options.getArchiverArgs());
try
{
processManager = new ProcessManager();
if(processManager.monitorLaunchedProcess(Runtime.getRuntime().exec(command.toString())) != 0)
{
return (false);
}
}
catch(IOException ex)
{
Debug.logException(ex);
return (false);
}
return (true);
}
/**
* @since VCafe 3.0
*/
public void cancel()
{
if(processManager != null)
{
processManager.destroyProcess();
processManager = null;
}
}
}