Open in github.dev
Open in a new github.dev tab
Permalink
Cannot retrieve contributors at this time
29 lines (24 sloc)
1.13 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Universal portable mode enabler | |
IDE subdirectory is needed. | |
.PARAMETER Directory | |
Current '$dir' of application | |
.PARAMETER Persist | |
Persist directory of application | |
#> | |
param([Parameter(Mandatory)][String] $Directory, [Parameter(Mandatory)][String] $Persist) | |
$properties = Join-Path 'IDE' 'bin\idea.properties' | |
if (!(Join-Path $Persist $properties | Test-Path)) { | |
Write-Host "File $properties does not exists. Creating." -ForegroundColor 'Yellow' | |
$fullProp = Join-Path $Directory $properties | |
$currentForward = (Split-Path $Directory | Join-Path -ChildPath 'current') -replace '\\', '/' | |
$profileDir = "$currentForward/profile" | |
$CONT = Get-Content $fullProp | |
# Set portable configuration | |
$CONT = $CONT -replace '^#\s*(idea.config.path=).*$', "`$1$profileDir/config" | |
$CONT = $CONT -replace '^#\s*(idea.system.path=).*$', "`$1$profileDir/system" | |
$CONT = $CONT -replace '^#\s*(idea.plugins.path=).*$', '$1${idea.config.path}/plugins' | |
$CONT = $CONT -replace '^#\s*(idea.log.path=).*$', '$1${idea.system.path}/log' | |
Set-Content -LiteralPath $fullProp -Value $CONT -Encoding 'Ascii' -Force | |
} |