本文整理汇总了Java中com.intellij.openapi.util.SystemInfo.isUnix方法的典型用法代码示例。如果您正苦于以下问题:Java SystemInfo.isUnix方法的具体用法?Java SystemInfo.isUnix怎么用?Java SystemInfo.isUnix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.SystemInfo
的用法示例。
在下文中一共展示了SystemInfo.isUnix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getApplicableFlavors
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static List<PythonSdkFlavor> getApplicableFlavors(boolean addPlatformIndependent) {
List<PythonSdkFlavor> result = new ArrayList<PythonSdkFlavor>();
if (SystemInfo.isWindows) {
result.add(WinPythonSdkFlavor.INSTANCE);
}
else if (SystemInfo.isMac) {
result.add(MacPythonSdkFlavor.INSTANCE);
}
else if (SystemInfo.isUnix) {
result.add(UnixPythonSdkFlavor.INSTANCE);
}
if (addPlatformIndependent)
result.addAll(getPlatformIndependentFlavors());
return result;
}
示例2: testUnicodePaths
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testUnicodePaths() throws Exception {
if (!SystemInfo.isUnix || SystemInfo.isMac) {
System.err.println("Ignored: well-defined FS required");
return;
}
File topDir = createTestDir(myTempDirectory, "top");
File testDir = createTestDir(topDir, "тест");
File testFile = createTestFile(testDir, "файл.txt");
refresh(topDir);
LocalFileSystem.WatchRequest request = watch(topDir);
try {
myAccept = true;
FileUtil.writeToFile(testFile, "abc");
assertEvent(VFileContentChangeEvent.class, testFile.getPath());
}
finally {
unwatch(request);
}
}
示例3: getCommand
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public String[] getCommand() {
String[] command;
String shellPath = TerminalOptionsProvider.getInstance().getShellPath();
if (SystemInfo.isUnix) {
File rcFile = findRCFile();
String shellName = getShellName(shellPath);
if (rcFile != null && (shellName.equals("bash") || shellName.equals("sh"))) {
command = new String[]{shellPath, "--rcfile", rcFile.getAbsolutePath(), "-i"};
}
else if (hasLoginArgument(shellName)) {
command = new String[]{shellPath, "--login"};
}
else {
command = shellPath.split(" ");
}
}
else {
command = new String[]{shellPath};
}
return command;
}
示例4: getOutputStream
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
@NotNull
public OutputStream getOutputStream(@NotNull VirtualFile file, Object requestor, long modStamp, final long timeStamp) throws IOException {
final File ioFile = convertToIOFileAndCheck(file);
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
final OutputStream stream = shallUseSafeStream(requestor, file) ?
new SafeFileOutputStream(ioFile, SystemInfo.isUnix) : new FileOutputStream(ioFile);
return new BufferedOutputStream(stream) {
@Override
public void close() throws IOException {
super.close();
if (timeStamp > 0 && ioFile.exists()) {
if (!ioFile.setLastModified(timeStamp)) {
LOG.warn("Failed: " + ioFile.getPath() + ", new:" + timeStamp + ", old:" + ioFile.lastModified());
}
}
}
};
}
示例5: destroyProcess
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
/**
* Destroys process tree: in case of windows via imitating ctrl+c, in case of unix via sending sig_int to every process in tree.
* @param process to kill with all sub-processes.
*/
static boolean destroyProcess(@NotNull final Process process, final boolean softKill) {
try {
if (SystemInfo.isWindows) {
sendCtrlEventThroughStream(process, softKill ? C : BRK);
return true;
}
else if (SystemInfo.isUnix) {
if (softKill) {
return UnixProcessManager.sendSigIntToProcessTree(process);
}
else {
return UnixProcessManager.sendSigKillToProcessTree(process);
}
}
else {
return false;
}
}
catch (Exception e) {
LOG.error("Couldn't terminate the process", e);
return false;
}
}
示例6: badNames
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Test
public void badNames() throws Exception {
final File file = FileUtil.createTempFile(myTempDirectory, "test.", ".txt");
FileUtil.writeToFile(file, myTestData);
assertFileAttributes(new File(file.getPath() + StringUtil.repeat(File.separator, 3)));
assertFileAttributes(new File(file.getPath().replace(File.separator, StringUtil.repeat(File.separator, 3))));
assertFileAttributes(new File(file.getPath().replace(File.separator, File.separator + "." + File.separator)));
assertFileAttributes(
new File(myTempDirectory, File.separator + ".." + File.separator + myTempDirectory.getName() + File.separator + file.getName()));
if (SystemInfo.isUnix) {
final File backSlashFile = FileUtil.createTempFile(myTempDirectory, "test\\", "\\txt");
FileUtil.writeToFile(backSlashFile, myTestData);
assertFileAttributes(backSlashFile);
}
}
示例7: compute
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@NotNull
@Override
protected Boolean compute() {
if (!SystemInfo.isUnix || !SystemInfo.hasXdgMime() || !new File("/usr/bin/nautilus").canExecute()) {
return false;
}
String appName = ExecUtil.execAndReadLine(new GeneralCommandLine("xdg-mime", "query", "default", "inode/directory"));
if (appName == null || !appName.matches("nautilus.*\\.desktop")) return false;
String version = ExecUtil.execAndReadLine(new GeneralCommandLine("nautilus", "--version"));
if (version == null) return false;
Matcher m = Pattern.compile("GNOME nautilus ([0-9.]+)").matcher(version);
return m.find() && StringUtil.compareVersionNumbers(m.group(1), "3") >= 0;
}
示例8: testBadFileName
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testBadFileName() throws Exception {
if (!SystemInfo.isUnix) {
System.err.println(getName() + " skipped: " + SystemInfo.OS_NAME);
return;
}
final File dir = FileUtil.createTempDirectory("test.", ".dir");
final File file = FileUtil.createTempFile(dir, "test\\", "\\txt", true);
final VirtualFile vDir = myFS.refreshAndFindFileByIoFile(dir);
assertNotNull(vDir);
assertEquals(0, vDir.getChildren().length);
((VirtualFileSystemEntry)vDir).markDirtyRecursively();
vDir.refresh(false, true);
final VirtualFile vFile = myFS.refreshAndFindFileByIoFile(file);
assertNull(vFile);
}
示例9: testLineBreaksInName
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testLineBreaksInName() throws Exception {
if (!SystemInfo.isUnix) {
System.err.println("Ignored: Unix required");
return;
}
File topDir = createTestDir(myTempDirectory, "topDir");
File testDir = createTestDir(topDir, "weird\ndir\nname");
File testFile = createTestFile(testDir, "weird\nfile\nname");
refresh(topDir);
LocalFileSystem.WatchRequest request = watch(topDir);
try {
myAccept = true;
FileUtil.writeToFile(testFile, "abc");
assertEvent(VFileContentChangeEvent.class, testFile.getPath());
}
finally {
unwatch(request);
}
}
示例10: getPATHenvVariableName
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static String getPATHenvVariableName() {
if (SystemInfo.isWindows) return "Path";
if (SystemInfo.isUnix) {
return "PATH";
} else {
return null;
}
}
示例11: checkExecutePermission
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static boolean checkExecutePermission(@NotNull File executable) {
if (executable.canExecute()) {
return true;
}
else {
return SystemInfo.isUnix && executable.setExecutable(true);
}
}
示例12: handshake
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
public String handshake() throws PyDebuggerException {
final VersionCommand command = new VersionCommand(this, LOCAL_VERSION, SystemInfo.isUnix ? "UNIX" : "WIN");
command.execute();
String version = command.getRemoteVersion();
if (version != null) {
version = version.trim();
}
return version;
}
示例13: getFileToSelect
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
public static VirtualFile getFileToSelect(@NotNull FileChooserDescriptor descriptor, @Nullable Project project,
@Nullable VirtualFile toSelect, @Nullable VirtualFile lastPath) {
boolean chooseDir = descriptor instanceof FileSaverDescriptor;
VirtualFile result;
if (toSelect == null && lastPath == null) {
result = project == null? null : project.getBaseDir();
}
else if (toSelect != null && lastPath != null) {
if (Boolean.TRUE.equals(descriptor.getUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT))) {
result = lastPath;
}
else {
result = toSelect;
}
}
else if (toSelect == null) {
result = lastPath;
}
else {
result = toSelect;
}
if (result != null) {
if (chooseDir && !result.isDirectory()) {
result = result.getParent();
}
}
else if (SystemInfo.isUnix) {
result = VfsUtil.getUserHomeDir();
}
return result;
}
示例14: destroyProcessGracefully
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
protected boolean destroyProcessGracefully() {
if (SystemInfo.isWindows && myMediatedProcess) {
return RunnerMediator.destroyProcess(myProcess, true);
}
else if (SystemInfo.isUnix) {
return UnixProcessManager.sendSigIntToProcessTree(myProcess);
}
return false;
}
示例15: clonePermissions
import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
protected boolean clonePermissions(@NotNull String source, @NotNull String target, boolean onlyPermissionsToExecute) throws Exception {
if (SystemInfo.isUnix) {
File srcFile = new File(source);
File dstFile = new File(target);
if (!onlyPermissionsToExecute) {
if (!dstFile.setWritable(srcFile.canWrite(), true)) return false;
}
return dstFile.setExecutable(srcFile.canExecute(), true);
}
return false;
}