private Bundle openInputBundle()

in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java [151:169]


	private Bundle openInputBundle(CommandLineOptions options) throws IOException {
		if (! options.hasInputBundle()) {
			return DataBundles.createBundle();
		} 
		Path inputBundlePath = Paths.get(options.getInputBundle());
		if (! Files.isReadable(inputBundlePath)) {
			throw new IOException("Can't read inputbundle: " + inputBundlePath);
		}
		if (options.hasSaveResultsToBundle() && 
				safeIsSameFile(inputBundlePath, Paths.get(options.getSaveResultsToBundle()))) {
			// Note: It is valid to do -bundle same.zip -inputbundle same.zip, 
			// in which case we should NOT open it as readOnly, as that
			// might make a copy unnecessarily. In case of symlinks we'll use the
			// path from -bundle to avoid double-opening later
			return DataBundles.openBundle(Paths.get(options.getSaveResultsToBundle()));				
		} else {			
			return DataBundles.openBundleReadOnly(inputBundlePath);
		}
	}