本文整理匯總了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;
}