mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
auto add access for test file path used in configureByPath()
This commit is contained in:
@@ -43,13 +43,12 @@ import java.io.File;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class VfsRootAccess {
|
||||
private static final boolean SHOULD_PERFORM_ACCESS_CHECK = System.getenv("NO_FS_ROOTS_ACCESS_CHECK") == null;
|
||||
// we don't want test subclasses to accidentally remove allowed files, added by base classes
|
||||
static final List<String> ourAdditionalRoots = new ArrayList<String>();
|
||||
private static final Set<String> ourAdditionalRoots = new THashSet<String>();
|
||||
private static boolean insideGettingRoots;
|
||||
|
||||
@TestOnly
|
||||
|
||||
+13
-13
@@ -82,6 +82,7 @@ import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.*;
|
||||
@@ -186,6 +187,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
|
||||
VirtualFile result;
|
||||
if (myTempDirFixture instanceof LightTempDirTestFixtureImpl) {
|
||||
VfsRootAccess.allowRootAccess(fromFile.getPath());
|
||||
VirtualFile fromVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(fromFile);
|
||||
if (fromVFile == null) {
|
||||
fromVFile = myTempDirFixture.getFile(sourceFilePath);
|
||||
@@ -231,20 +233,18 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
if (myTempDirFixture instanceof LightTempDirTestFixtureImpl) {
|
||||
return myTempDirFixture.copyAll(fromFile.getPath(), targetPath);
|
||||
}
|
||||
else {
|
||||
final File targetFile = new File(getTempDirPath() + "/" + targetPath);
|
||||
try {
|
||||
FileUtil.copyDir(fromFile, targetFile);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile);
|
||||
Assert.assertNotNull(file);
|
||||
file.refresh(false, true);
|
||||
return file;
|
||||
final File targetFile = new File(getTempDirPath() + "/" + targetPath);
|
||||
try {
|
||||
FileUtil.copyDir(fromFile, targetFile);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile);
|
||||
Assert.assertNotNull(file);
|
||||
file.refresh(false, true);
|
||||
return file;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user