if (srcPath != null && !srcPath.equals(relPath))
relPath = makeRelativeTo(relPath, srcPath);
// If the src file path is a file, use the file's name as
// relative path.
if (srcPath != null && srcPath.equals(relPath))
relPath = new Path(relPath.lastSegment());
File newFile = new File(new Path(targetFile.getAbsolutePath())
.append(relPath).toPortableString());
FileUtil.createFile(newFile, false);
fos = new FileOutputStream(newFile);