mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
transfer 'user.home' path variable to compile server
This commit is contained in:
@@ -462,8 +462,9 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
private static RequestFuture sendSetupRequest(final @NotNull CompileServerClient client) throws Exception {
|
||||
final Map<String, String> data = new HashMap<String, String>();
|
||||
|
||||
// need this for tests and when this macro is missing from PathMacros registry
|
||||
data.put(PathMacrosImpl.APPLICATION_HOME_MACRO_NAME, FileUtil.toSystemIndependentName(PathManager.getHomePath()));
|
||||
for (Map.Entry<String, String> entry : PathMacrosImpl.getGlobalSystemMacros().entrySet()) {
|
||||
data.put(entry.getKey(), FileUtil.toSystemIndependentName(entry.getValue()));
|
||||
}
|
||||
|
||||
final PathMacros pathVars = PathMacros.getInstance();
|
||||
for (String name : pathVars.getAllMacroNames()) {
|
||||
|
||||
+2
-1
@@ -43,7 +43,8 @@ public class ModulePathMacroManager extends BasePathMacroManager {
|
||||
public ReplacePathToMacroMap getReplacePathMap() {
|
||||
ReplacePathToMacroMap result = super.getReplacePathMap();
|
||||
if (!myModule.isDisposed()) {
|
||||
addFileHierarchyReplacements(result, PathMacrosImpl.MODULE_DIR_MACRO_NAME, getModuleDir(myModule.getModuleFilePath()), getUserHome());
|
||||
addFileHierarchyReplacements(result, PathMacrosImpl.MODULE_DIR_MACRO_NAME, getModuleDir(myModule.getModuleFilePath()), PathMacrosImpl
|
||||
.getUserHome());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.application.options;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ExpandMacroToPathMap;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -25,6 +26,8 @@ import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.NamedJDOMExternalizable;
|
||||
import com.intellij.openapi.util.RoamingTypeDisabled;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.concurrency.JBReentrantReadWriteLock;
|
||||
import com.intellij.util.concurrency.LockFactory;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -181,6 +184,13 @@ public class PathMacrosImpl extends PathMacros implements ApplicationComponent,
|
||||
if (!myIgnoredMacros.contains(name)) myIgnoredMacros.add(name);
|
||||
}
|
||||
|
||||
public static Map<String, String> getGlobalSystemMacros() {
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(APPLICATION_HOME_MACRO_NAME, PathManager.getHomePath());
|
||||
map.put(USER_HOME_MACRO_NAME, getUserHome());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnoredMacroName(@NotNull String macro) {
|
||||
return myIgnoredMacros.contains(macro);
|
||||
@@ -348,4 +358,8 @@ public class PathMacrosImpl extends PathMacros implements ApplicationComponent,
|
||||
myLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUserHome() {
|
||||
return StringUtil.trimEnd(SystemProperties.getUserHome(), "/");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-12
@@ -17,14 +17,12 @@ package com.intellij.openapi.components.impl;
|
||||
|
||||
import com.intellij.application.options.PathMacrosImpl;
|
||||
import com.intellij.application.options.ReplacePathToMacroMap;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.ExpandMacroToPathMap;
|
||||
import com.intellij.openapi.components.PathMacroManager;
|
||||
import com.intellij.openapi.components.PathMacroMap;
|
||||
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -74,22 +72,18 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
|
||||
public ExpandMacroToPathMap getExpandMacroMap() {
|
||||
ExpandMacroToPathMap result = new ExpandMacroToPathMap();
|
||||
result.addMacroExpand(PathMacrosImpl.APPLICATION_HOME_MACRO_NAME, PathManager.getHomePath());
|
||||
result.addMacroExpand(PathMacrosImpl.USER_HOME_MACRO_NAME, getUserHome());
|
||||
for (Map.Entry<String, String> entry : PathMacrosImpl.getGlobalSystemMacros().entrySet()) {
|
||||
result.addMacroExpand(entry.getKey(), entry.getValue());
|
||||
}
|
||||
getPathMacros().addMacroExpands(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static String getUserHome() {
|
||||
return StringUtil.trimEnd(SystemProperties.getUserHome(), "/");
|
||||
}
|
||||
|
||||
|
||||
public ReplacePathToMacroMap getReplacePathMap() {
|
||||
ReplacePathToMacroMap result = new ReplacePathToMacroMap();
|
||||
|
||||
result.addMacroReplacement(PathManager.getHomePath(), PathMacrosImpl.APPLICATION_HOME_MACRO_NAME);
|
||||
result.addMacroReplacement(getUserHome(), PathMacrosImpl.USER_HOME_MACRO_NAME);
|
||||
for (Map.Entry<String, String> entry : PathMacrosImpl.getGlobalSystemMacros().entrySet()) {
|
||||
result.addMacroReplacement(entry.getValue(), entry.getKey());
|
||||
}
|
||||
getPathMacros().addMacroReplacements(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user