本文整理汇总了Java中com.intellij.openapi.util.SystemInfo.areSymLinksSupported方法的典型用法代码示例。如果您正苦于以下问题:Java SystemInfo.areSymLinksSupported方法的具体用法?Java SystemInfo.areSymLinksSupported怎么用?Java SystemInfo.areSymLinksSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.SystemInfo
的用法示例。
在下文中一共展示了SystemInfo.areSymLinksSupported方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBrokenSymlinkMove
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testBrokenSymlinkMove() throws IOException, InterruptedException {
if (!SystemInfo.areSymLinksSupported) {
System.err.println(getName() + " skipped: " + SystemInfo.OS_NAME);
return;
}
final File srcDir = IoTestUtil.createTestDir("src");
final File link = IoTestUtil.createSymLink(srcDir.getPath() + "/missing", srcDir.getPath() + "/link", false);
final File dstDir = IoTestUtil.createTestDir("dst");
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
VirtualFile file = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(file);
VirtualFile target = myFS.refreshAndFindFileByIoFile(dstDir);
assertNotNull(target);
myFS.moveFile(this, file, target);
}
}.execute();
assertOrderedEquals(ArrayUtil.EMPTY_STRING_ARRAY, srcDir.list());
assertOrderedEquals(new String[]{link.getName()}, dstDir.list());
}
示例2: runTest
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
protected void runTest() throws Throwable {
if (SystemInfo.areSymLinksSupported) {
super.runTest();
}
else {
System.err.println("Skipped: " + getName());
}
}
示例3: testSymlinkTargetBlink
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testSymlinkTargetBlink() throws Exception {
if (!SystemInfo.areSymLinksSupported) {
System.err.println("Ignored: symlinks not supported");
return;
}
File top = createTempDirectory(true);
File target = IoTestUtil.createTestDir(top, "target");
File link = IoTestUtil.createSymLink(target.getPath(), top.getPath() + "/link");
VirtualFile vTop = myFS.refreshAndFindFileByIoFile(top);
assertNotNull(vTop);
assertTrue(vTop.isValid());
VirtualFile vTarget = myFS.refreshAndFindFileByIoFile(target);
assertNotNull(vTarget);
assertTrue(vTarget.isValid());
VirtualFile vLink = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(vLink);
assertTrue(vLink.isValid());
assertTrue(vLink.isDirectory());
FileUtil.delete(target);
vTop.refresh(false, true);
assertFalse(vTarget.isValid());
assertFalse(vLink.isValid());
vLink = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(vLink);
assertTrue(vLink.isValid());
assertFalse(vLink.isDirectory());
FileUtil.createDirectory(target);
vTop.refresh(false, true);
assertFalse(vLink.isValid());
vLink = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(vLink);
assertTrue(vLink.isValid());
assertTrue(vLink.isDirectory());
}
示例4: isSymLink
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
/**
* Checks if a last element in the path is a symlink.
*/
public static boolean isSymLink(@NotNull String path) {
if (SystemInfo.areSymLinksSupported) {
final FileAttributes attributes = getAttributes(path);
return attributes != null && attributes.isSymLink();
}
return false;
}