/** * Writes the passed resource to the current archive. * * @param resource the file to be written * @param destinationPath the path for the file inside the archive * @throws CoreException to signal any other unusual termination. * This can also be used to return information * in the status object. */ public void write(IFile resource, IPath destinationPath) throws CoreException { try { IPath fileLocation= resource.getLocation(); File file= null; if (fileLocation != null) { file= new File(fileLocation.toOSString()); } if (fJarPackage.areDirectoryEntriesIncluded()) addDirectories(destinationPath, file); addFile(resource, destinationPath, file); } catch (IOException ex) { // Ensure full path is visible String message= null; if (ex.getLocalizedMessage() != null) message= Messages.format(JarPackagerMessages.JarWriter_writeProblemWithMessage, new Object[] {resource.getFullPath(), ex.getLocalizedMessage()}); else message= Messages.format(JarPackagerMessages.JarWriter_writeProblem, resource.getFullPath()); throw JarPackagerUtil.createCoreException(message, ex); } }
/** * Writes the passed resource to the current archive. * * @param resource the file to be written * @param destinationPath the path for the file inside the archive * @throws CoreException to signal any other unusual termination. * This can also be used to return information * in the status object. */ public void write(IFile resource, IPath destinationPath) throws CoreException { try { IPath fileLocation= resource.getLocation(); File file= null; if (fileLocation != null) { file= fileLocation.toFile(); } if (fJarPackage.areDirectoryEntriesIncluded()) addDirectories(destinationPath, file); addFile(resource, destinationPath, file); } catch (IOException ex) { // Ensure full path is visible String message= null; if (ex.getLocalizedMessage() != null) message= Messages.format(JarPackagerMessages.JarWriter_writeProblemWithMessage, new Object[] {BasicElementLabels.getPathLabel(resource.getFullPath(), false), ex.getLocalizedMessage()}); else message= Messages.format(JarPackagerMessages.JarWriter_writeProblem, BasicElementLabels.getPathLabel(resource.getFullPath(), false)); throw JarPackagerUtil.createCoreException(message, ex); } }
/** * Writes the passed resource to the current archive. * * @param resource the file to be written * @param destinationPath the path for the file inside the archive * @throws CoreException to signal any other unusual termination. * This can also be used to return information * in the status object. */ public void write(IFile resource, IPath destinationPath) throws CoreException { try { IPath fileLocation= resource.getLocation(); File file= null; if (fileLocation != null) { file= fileLocation.toFile(); } if (fJarPackage.areDirectoryEntriesIncluded()) addDirectories(destinationPath, file); addFile(resource, destinationPath, file); } catch (IOException ex) { // Ensure full path is visible String message= null; if (ex.getLocalizedMessage() != null) message= Messages.format(JarPackagerMessages.JarWriter_writeProblemWithMessage, new Object[] {BasicElementLabels.getPathLabel(resource.getFullPath(), false), ex.getLocalizedMessage()}); else message= Messages.format(JarPackagerMessages.JarWriter_writeProblem, BasicElementLabels.getPathLabel(resource.getFullPath(), false)); throw JarPackagerUtil.createCoreException(message, ex); } }