22package com.intellij.util.singleProduct
33
44import com.intellij.idea.AppMode
5- import com.intellij.idea.AppModeAssertions
65import com.intellij.internal.InternalActionsBundle
76import com.intellij.internal.statistic.eventLog.EventLogGroup
87import com.intellij.internal.statistic.eventLog.events.EventId
@@ -49,20 +48,16 @@ private const val MIGRATION_FILE_MARKER = ".ce_migration_attempted"
4948@ApiStatus.Internal
5049fun migrateCommunityToSingleProductIfNeeded (args : List <String >) {
5150 if (
52- OS .CURRENT != OS .macOS ||
5351 ! (PlatformUtils .isIdeaUltimate() || @Suppress(" DEPRECATION" ) PlatformUtils .isPyCharmPro()) ||
54- isRemDev ()
52+ AppMode .isRemoteDevHost ()
5553 ) return
5654
5755 val currentDir = PathManager .getHomeDir().parent
5856 val currentDirName = currentDir.name
5957 val newDirName = currentDirName.replace(" CE" , " " ).replace(" Community Edition" , " " )
6058 if (newDirName == currentDirName) return
6159
62- val newDir = currentDir.resolveSibling(newDirName)
63- if (Files .exists(newDir)) return
64-
65- // a marker file is used because standard storage is unavailable at this early startup stage
60+ // a marker file is used because standard storage is unavailable at this early startup stage (used later to trigger the Vision page)
6661 val migrationAttemptMarker = PathManager .getConfigDir().resolve(MIGRATION_FILE_MARKER )
6762 try {
6863 Files .writeString(migrationAttemptMarker, " " , StandardOpenOption .CREATE_NEW )
@@ -71,17 +66,19 @@ fun migrateCommunityToSingleProductIfNeeded(args: List<String>) {
7166 return
7267 }
7368
69+ if (! (OS .CURRENT == OS .macOS && currentDirName.endsWith(" .app" ))) return
70+
71+ val newDir = currentDir.resolveSibling(newDirName)
72+ if (Files .exists(newDir)) return
73+
7474 val renameCommand = listOf (" /bin/mv" , " -n" , currentDir.toString(), newDir.toString())
7575 val startCommand = listOf (newDir.resolve(" Contents/MacOS/${ApplicationNamesInfo .getInstance().scriptName} " ).toString()) + args
7676 Restarter .setMainAppArgs(args) // fallback if the rename fails
7777 Restarter .scheduleRestart(false , renameCommand, startCommand)
7878 exitProcess(0 )
7979}
8080
81- private fun isRemDev (): Boolean = AppMode .isRemoteDevHost() || AppModeAssertions .isFrontend()
82-
83- private const val VISION_URL_MARKER = " \$ __VISION_PAGE_SETTINGS_MEDIA_BASE_PATH__\$ "
84-
81+ private const val VISION_URL_MARKER = $$" $__VISION_PAGE_SETTINGS_MEDIA_BASE_PATH__ $"
8582private const val VISION_RESOURCE_PACKAGE_PREFIX = " migration"
8683
8784@ApiStatus.Internal
@@ -98,7 +95,7 @@ class MigrationStartupActivity : ProjectActivity {
9895
9996 @OptIn(ExperimentalSerializationApi ::class )
10097 override suspend fun execute (project : Project ) {
101- if (! PlatformUtils .isIdeaUltimate() && ! PlatformUtils .isPyCharmPro() || isRemDev ()) {
98+ if (! PlatformUtils .isIdeaUltimate() && @Suppress( " DEPRECATION " ) ! PlatformUtils .isPyCharmPro() || AppMode .isRemoteDevHost ()) {
10299 return
103100 }
104101 val migrationAttemptMarker = PathManager .getConfigDir().resolve(MIGRATION_FILE_MARKER )
@@ -174,7 +171,7 @@ class MigrationStartupActivity : ProjectActivity {
174171
175172@ApiStatus.Internal
176173private object MigrateToSingleProductCollector : CounterUsagesCollector() {
177- private val GROUP = EventLogGroup (" migrate.to.single.product" , 1 )
174+ private val GROUP = @Suppress( " DEPRECATION " ) EventLogGroup (" migrate.to.single.product" , 1 )
178175
179176 @JvmField
180177 val WELCOME_PAGE_SHOWN : EventId = GROUP .registerEvent(" vision.page.shown" , " How many times button on welcome vision page was shown after patch update to SID" )
0 commit comments