for(FilePatch patch: myPatches) {
VirtualFile baseDir = myDetectedBaseDirectory == null
? getBaseDirectory()
: LocalFileSystem.getInstance().findFileByPath(myDetectedBaseDirectory.replace(File.separatorChar, '/'));
int skipTopDirs = myDetectedStripLeadingDirs >= 0 ? myDetectedStripLeadingDirs : 0;
<BUG>VirtualFile fileToPatch = patch.findFileToPatch(baseDir, skipTopDirs);
</BUG>
if (fileToPatch == null) {
String oldDetectedBaseDirectory = myDetectedBaseDirectory;
int oldDetectedStripLeadingDirs = myDetectedStripLeadingDirs;

for(FilePatch patch: myPatches) {
VirtualFile baseDir = myDetectedBaseDirectory == null
? getBaseDirectory()
: LocalFileSystem.getInstance().findFileByPath(myDetectedBaseDirectory.replace(File.separatorChar, '/'));
int skipTopDirs = myDetectedStripLeadingDirs >= 0 ? myDetectedStripLeadingDirs : 0;
VirtualFile fileToPatch = patch.findFileToPatch(baseDir, skipTopDirs, false);
if (fileToPatch == null) {
String oldDetectedBaseDirectory = myDetectedBaseDirectory;
int oldDetectedStripLeadingDirs = myDetectedStripLeadingDirs;
