mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
expandMacroMap — system macro should have a higher priority
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import com.intellij.application.options.PathMacrosImpl
|
||||
import com.intellij.openapi.components.impl.BasePathMacroManager
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.jetbrains.jps.model.serialization.PathMacroUtil
|
||||
import org.junit.Test
|
||||
|
||||
class LightPathMacroManagerTest {
|
||||
@Test
|
||||
fun systemOverridesUser() {
|
||||
val macros = PathMacrosImpl()
|
||||
macros.setMacro("foo", "/home/user")
|
||||
|
||||
val manager = BasePathMacroManager(macros)
|
||||
assertThat(manager.collapsePath(com.intellij.util.SystemProperties.getUserHome())).isEqualTo("$${PathMacroUtil.USER_HOME_NAME}$")
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -103,20 +103,20 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
@NotNull
|
||||
public ExpandMacroToPathMap getExpandMacroMap() {
|
||||
ExpandMacroToPathMap result = new ExpandMacroToPathMap();
|
||||
getPathMacros().addMacroExpands(result);
|
||||
for (Map.Entry<String, String> entry : PathMacroUtil.getGlobalSystemMacros().entrySet()) {
|
||||
result.addMacroExpand(entry.getKey(), entry.getValue());
|
||||
}
|
||||
getPathMacros().addMacroExpands(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ReplacePathToMacroMap getReplacePathMap() {
|
||||
ReplacePathToMacroMap result = new ReplacePathToMacroMap();
|
||||
getPathMacros().addMacroReplacements(result);
|
||||
for (Map.Entry<String, String> entry : PathMacroUtil.getGlobalSystemMacros().entrySet()) {
|
||||
result.addMacroReplacement(entry.getValue(), entry.getKey());
|
||||
}
|
||||
getPathMacros().addMacroReplacements(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user