mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
settings: rename method for more clarity and deduplication with the method in settings repository plugin
GitOrigin-RevId: 924ba021484b8262dad8eba5e50c0ca2374e031a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
01c7cfa3f8
commit
b2528cd11d
@@ -1,11 +1,10 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.configurationStore.schemeManager.ROOT_CONFIG
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream
|
||||
import com.intellij.serviceContainer.ComponentManagerImpl
|
||||
import com.intellij.testFramework.*
|
||||
@@ -15,7 +14,6 @@ import com.intellij.util.io.lastModified
|
||||
import com.intellij.util.io.write
|
||||
import com.intellij.util.io.writeChild
|
||||
import com.intellij.util.io.*
|
||||
import com.intellij.util.pico.DefaultPicoContainer
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@@ -385,7 +383,7 @@ internal class ApplicationStoreTest {
|
||||
|
||||
componentStore.save()
|
||||
|
||||
val osCode = getOsFolderName()
|
||||
val osCode = getPerOsSettingsStorageFolderName()
|
||||
val fs = testAppConfig.fileSystem
|
||||
assertTrue("${osCode}/peros.xml doesn't exist", testAppConfig.resolve(fs.getPath(osCode, "peros.xml")).exists())
|
||||
assertFalse("Old peros.xml without os prefix was not removed", testAppConfig.resolve("peros.xml").exists())
|
||||
@@ -403,7 +401,7 @@ internal class ApplicationStoreTest {
|
||||
|
||||
componentStore.save()
|
||||
|
||||
val osCode = getOsFolderName()
|
||||
val osCode = getPerOsSettingsStorageFolderName()
|
||||
val fs = testAppConfig.fileSystem
|
||||
assertTrue("${osCode}/peros.xml doesn't exist", testAppConfig.resolve(fs.getPath(osCode, "peros.xml")).exists())
|
||||
assertFalse("Old peros.xml without os prefix was not removed", testAppConfig.resolve("peros.xml").exists())
|
||||
@@ -411,7 +409,7 @@ internal class ApplicationStoreTest {
|
||||
|
||||
@Test
|
||||
fun `per-os setting is preferred from os subfolder`() {
|
||||
val osCode = getOsFolderName()
|
||||
val osCode = getPerOsSettingsStorageFolderName()
|
||||
writeConfig("peros.xml", "<application>${createComponentData("old")}</application>")
|
||||
writeConfig("${osCode}/peros.xml", "<application>${createComponentData("new")}</application>")
|
||||
|
||||
|
||||
@@ -183,10 +183,10 @@ fun getStoragePathSpec(storage: Storage): String {
|
||||
}
|
||||
|
||||
fun getOsDependentStorage(storagePathSpec: String): String {
|
||||
return getOsFolderName() + "/" + storagePathSpec
|
||||
return getPerOsSettingsStorageFolderName() + "/" + storagePathSpec
|
||||
}
|
||||
|
||||
fun getOsFolderName(): String {
|
||||
fun getPerOsSettingsStorageFolderName(): String {
|
||||
if (SystemInfo.isMac) return "mac"
|
||||
if (SystemInfo.isWindows) return "windows"
|
||||
if (SystemInfo.isLinux) return "linux"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.application
|
||||
|
||||
import com.intellij.configurationStore.getOsFolderName
|
||||
import com.intellij.configurationStore.getPerOsSettingsStorageFolderName
|
||||
import com.intellij.diagnostic.VMOptions
|
||||
import com.intellij.ide.plugins.PluginBuilder
|
||||
import com.intellij.ide.startup.StartupActionScriptManager
|
||||
@@ -118,7 +118,7 @@ class ConfigImportHelperTest : ConfigImportHelperBaseTest() {
|
||||
val newConfigDir = createConfigDir("2019.2", product = "DataGrip")
|
||||
ConfigImportHelper.setKeymapIfNeeded(oldConfigDir, newConfigDir, LOG)
|
||||
|
||||
val optionFile = newConfigDir.resolve("${PathManager.OPTIONS_DIRECTORY}/${getOsFolderName()}/keymap.xml")
|
||||
val optionFile = newConfigDir.resolve("${PathManager.OPTIONS_DIRECTORY}/${getPerOsSettingsStorageFolderName()}/keymap.xml")
|
||||
if (isMigrationExpected) {
|
||||
assertThat(optionFile).usingCharset(StandardCharsets.UTF_8).hasContent("""
|
||||
<application>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.settingsRepository
|
||||
|
||||
import com.intellij.configurationStore.getPerOsSettingsStorageFolderName
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
|
||||
@@ -18,7 +19,7 @@ internal fun getOsFolderName() = when {
|
||||
internal fun toRepositoryPath(path: String, roamingType: RoamingType): String {
|
||||
if (roamingType == RoamingType.PER_OS) {
|
||||
// mac/keymap.xml -> keymap.xml
|
||||
val pathWithoutOsPrefix = path.removePrefix(com.intellij.configurationStore.getOsFolderName() + "/")
|
||||
val pathWithoutOsPrefix = path.removePrefix(getPerOsSettingsStorageFolderName() + "/")
|
||||
// keymap.xml -> _mac/keymap.xml
|
||||
return "${getOsFolderName()}/$pathWithoutOsPrefix"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user