mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[platform] acknowledging the dirty reality of I/O producing exceptions sometimes
GitOrigin-RevId: 7e262eda77247185f877e86783e5adfb35edc21f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5db2bb6d73
commit
75a2117432
@@ -131,17 +131,16 @@ public final class PerProcessPathCustomizer implements PathCustomizer {
|
||||
}
|
||||
|
||||
public static void prepareConfig(Path newConfig, Path oldConfigPath, boolean migratePlugins) {
|
||||
if (isConfigImportNeeded(oldConfigPath)) {
|
||||
customTargetDirectoryToImportConfig = oldConfigPath;
|
||||
}
|
||||
else if (migratePlugins) {
|
||||
/* The config directory exists, but the plugins for the frontend process weren't migrated, so we trigger importing of config from the
|
||||
local IDE to migrate the plugins. */
|
||||
customTargetDirectoryToImportConfig = newConfig;
|
||||
new CustomConfigMigrationOption.MigrateFromCustomPlace(oldConfigPath).writeConfigMarkerFile(newConfig);
|
||||
}
|
||||
|
||||
try {
|
||||
if (isConfigImportNeeded(oldConfigPath)) {
|
||||
customTargetDirectoryToImportConfig = oldConfigPath;
|
||||
}
|
||||
else if (migratePlugins) {
|
||||
// The config directory exists, but the plugins for the frontend process weren't migrated,
|
||||
// so we trigger importing of config from the local IDE to migrate the plugins.
|
||||
customTargetDirectoryToImportConfig = newConfig;
|
||||
new CustomConfigMigrationOption.MigrateFromCustomPlace(oldConfigPath).writeConfigMarkerFile(newConfig);
|
||||
}
|
||||
CustomConfigFiles.prepareConfigDir(newConfig, oldConfigPath);
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
@@ -285,7 +285,12 @@ public final class ConfigImportHelper {
|
||||
}
|
||||
|
||||
if (settings == null || settings.shouldRestartAfterVmOptionsChange()) {
|
||||
new CustomConfigMigrationOption.SetProperties(properties).writeConfigMarkerFile(newConfigDir);
|
||||
try {
|
||||
new CustomConfigMigrationOption.SetProperties(properties).writeConfigMarkerFile(newConfigDir);
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.error("cannot write config migration marker file to " + newConfigDir, e);
|
||||
}
|
||||
restart(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.util.io.NioFiles
|
||||
import org.jetbrains.annotations.VisibleForTesting
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -25,6 +26,7 @@ private val log = logger<CustomConfigMigrationOption>()
|
||||
*/
|
||||
sealed class CustomConfigMigrationOption {
|
||||
@JvmOverloads
|
||||
@Throws(IOException::class)
|
||||
fun writeConfigMarkerFile(configDir: Path = PathManager.getOriginalConfigDir()) {
|
||||
val markerFile = getCustomConfigMarkerFilePath(configDir)
|
||||
if (Files.exists(markerFile)) {
|
||||
|
||||
Reference in New Issue
Block a user