correctly process file in packaging compiler if filename case is changed

This commit is contained in:
Nikolay Chashnikov
2009-09-11 18:16:46 +04:00
parent cf01415fd6
commit 76d6570d33
2 changed files with 9 additions and 1 deletions
@@ -13,6 +13,7 @@ import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.PathUtil;
import com.intellij.util.text.FilePathHashingStrategy;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -242,7 +243,7 @@ public class ProcessingItemsBuilder extends BuildInstructionVisitor {
final VirtualFile[] children = sourceFile.getChildren();
THashMap<String, VirtualFile> outputChildren = null;
if (outputFile != null) {
outputChildren = new THashMap<String, VirtualFile>();
outputChildren = new THashMap<String, VirtualFile>(FilePathHashingStrategy.create());
VirtualFile[] files = outputFile.getChildren();
if (files != null) {
for (VirtualFile file : files) {
@@ -16,6 +16,7 @@ import com.intellij.openapi.roots.impl.OrderEntryUtil;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
@@ -204,6 +205,12 @@ public class DeploymentUtilImpl extends DeploymentUtil {
if (LOG.isDebugEnabled()) {
LOG.debug("Copy file '" + fromFile + "' to '"+toFile+"'");
}
if (toFile.exists() && !SystemInfo.isFileSystemCaseSensitive) {
File canonicalFile = toFile.getCanonicalFile();
if (!canonicalFile.getAbsolutePath().equals(toFile.getAbsolutePath())) {
FileUtil.delete(toFile);
}
}
FileUtil.copy(fromFile, toFile);
}
catch (IOException e) {