|
@@ -20,30 +20,36 @@ try {
|
|
|
|
|
|
Write-Host "Setting cryptomator.disableUpdateCheck to: $shouldDisable"
|
|
|
if (-not $shouldDisable) {
|
|
|
- Write-Host "Disable-Update-Check property is by default 'false'. Skipping config modification."
|
|
|
+ Write-Host 'Disable-Update-Check property is by default "false". Skipping config modification.'
|
|
|
exit 0
|
|
|
}
|
|
|
|
|
|
# Determine the .cfg file path
|
|
|
- $cfgFile = Join-Path $($PSScriptRoot) "app\Cryptomator.cfg"
|
|
|
+ $cfgDir = Join-Path $PSScriptRoot 'app'
|
|
|
+ $cfgFiles = Get-ChildItem -Path $cfgDir -Filter '*.cfg' -File
|
|
|
|
|
|
- if (-not (Test-Path $cfgFile)) {
|
|
|
- Write-Error "Configuration file not found at: $cfgFile"
|
|
|
+ if ($cfgFiles.Count -eq 0) {
|
|
|
+ Write-Error "No .cfg file found in directory: $cfgDir"
|
|
|
exit 1
|
|
|
}
|
|
|
|
|
|
- # Read the current configuration
|
|
|
- $content = Get-Content $cfgFile -Raw
|
|
|
-
|
|
|
- # Add the new option based on the property value
|
|
|
- # Use regular expressions substitutions to replace the property
|
|
|
- $searchExpression = '(?<Prefix>java-options=-Dcryptomator\.disableUpdateCheck)=false'
|
|
|
- $replacementExpression = '${Prefix}=true'
|
|
|
- $content = $content -replace $searchExpression,$replacementExpression
|
|
|
+ foreach ($file in $cfgFiles) {
|
|
|
+ $cfgFile = $file.FullName
|
|
|
+ Write-Host "Modifying configuration file: $cfgFile"
|
|
|
+ # Read the current configuration
|
|
|
+ $content = Get-Content $cfgFile -Raw -ErrorAction Stop
|
|
|
+
|
|
|
+ # Add the new option based on the property value
|
|
|
+ # Use regular expressions substitutions to replace the property
|
|
|
+ $searchExpression = '(?<Prefix>java-options=-Dcryptomator\.disableUpdateCheck)=false'
|
|
|
+ $replacementExpression = '${Prefix}=true'
|
|
|
+ $content = $content -replace $searchExpression,$replacementExpression
|
|
|
+
|
|
|
+ # Write the modified content back
|
|
|
+ Set-Content -Path $cfgFile -Value $content -NoNewline
|
|
|
+ Write-Host "Successfully updated $cfgFile"
|
|
|
+ }
|
|
|
|
|
|
- # Write the modified content back
|
|
|
- Set-Content -Path $cfgFile -Value $content -NoNewline
|
|
|
- Write-Host "Successfully updated $cfgFile"
|
|
|
exit 0
|
|
|
}
|
|
|
catch {
|