public static ApplyPatchStatus applyPatch(final Project project, final List<FilePatch> patches, final VirtualFile baseDirectory,
<BUG>final int stripLeadingDirectories) {
List<VirtualFile> filesToMakeWritable = new ArrayList<VirtualFile>();</BUG>
for(FilePatch patch: patches) {
<BUG>VirtualFile fileToPatch = patch.findFileToPatch(baseDirectory, stripLeadingDirectories);
</BUG>
if (fileToPatch != null && !fileToPatch.isDirectory()) {
filesToMakeWritable.add(fileToPatch);
FileType fileType = fileToPatch.getFileType();
if (fileType == StdFileTypes.UNKNOWN) {

public static ApplyPatchStatus applyPatch(final Project project, final List<FilePatch> patches, final VirtualFile baseDirectory,
final int stripLeadingDirectories, final boolean createDirectories) {
List<VirtualFile> filesToMakeWritable = new ArrayList<VirtualFile>();
for(FilePatch patch: patches) {
VirtualFile fileToPatch = patch.findFileToPatch(baseDirectory, stripLeadingDirectories, false);
if (fileToPatch != null && !fileToPatch.isDirectory()) {
filesToMakeWritable.add(fileToPatch);
FileType fileType = fileToPatch.getFileType();
if (fileType == StdFileTypes.UNKNOWN) {
