import com.intellij.openapi.util.Key;
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.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
}
return vFile;
}
+
+ public static void assertFilePathEndsWithCaseSensitivePath(@NotNull VirtualFile file, @NotNull String suffixPath) {
+ String vfsSuffixPath = FileUtil.toSystemIndependentName(suffixPath);
+ String vfsPath = file.getPath();
+ if (!SystemInfo.isFileSystemCaseSensitive && !vfsPath.endsWith(vfsSuffixPath) &&
+ StringUtil.endsWithIgnoreCase(vfsPath, vfsSuffixPath)) {
+ String realSuffixPath = vfsPath.substring(vfsPath.length() - vfsSuffixPath.length());
+ Assert.fail("Please correct case-sensitivity of path to prevent test failure on case-sensitive file systems:\n" +
+ " path " + suffixPath + "\n" +
+ "real path " + realSuffixPath);
+ }
+ }
}
fromVFile = myTempDirFixture.getFile(sourceFilePath);
}
Assert.assertNotNull("can't find test data file " + sourceFilePath + " (" + testDataPath + ")", fromVFile);
+ VfsTestUtil.assertFilePathEndsWithCaseSensitivePath(fromVFile, sourceFilePath);
result = myTempDirFixture.copyFile(fromVFile, targetPath);
}
else {
final VirtualFile copy = LocalFileSystem.getInstance().refreshAndFindFileByPath(fullPath.replace(File.separatorChar, '/'));
Assert.assertNotNull("file " + fullPath + " not found", copy);
+ VfsTestUtil.assertFilePathEndsWithCaseSensitivePath(copy, filePath);
return copy;
}