{
    "version": "6.39.11548",
    "description": "Number-one tool for cleaning PC",
    "homepage": "https://www.ccleaner.com/ccleaner",
    "license": "Freeware",
    "url": "https://download.ccleaner.com/portable/ccsetup639.zip",
    "hash": "1a76f7d0d3eb7a0f1ed25e92d14a78d0dd431a85ba4a88022b7125d618da2afa",
    "pre_install": [
        "if (!(Test-Path \"$persist_dir\\ccleaner.ini\")) {",
        "   Set-Content \"$dir\\ccleaner.ini\" @('[Options]', 'UpdateAuto=0', 'UpdateNotify=0', 'UpdateCheck=0', 'HelpImproveCCleaner=0') -Encoding ASCII",
        "}",
        "'winapp.ini', 'winreg.ini', 'winsys.ini' | ForEach-Object {",
        "   if (!(Test-Path \"$persist_dir\\$_\")) { New-Item \"$dir\\$_\" | Out-Null }",
        "}",
        "Copy-Item \"$persist_dir\\*\" \"$dir\" -Include 'branding.dll', 'CCleaner.dat' -ErrorAction SilentlyContinue"
    ],
    "post_install": [
        "# Workaround for https://github.com/ScoopInstaller/Extras/issues/15946",
        "# Create shortcut and shim",
        "$exe = if ($architecture -eq '32bit') { 'CCleaner.exe' } else { 'CCleaner64.exe' }",
        "startmenu_shortcut \"$original_dir\\$exe\" 'CCleaner' $null $null $global",
        "shim \"$original_dir\\$exe\" $global 'ccleaner'"
    ],
    "persist": [
        "ccleaner.ini",
        "winapp.ini",
        "winreg.ini",
        "winsys.ini"
    ],
    "pre_uninstall": "Copy-Item \"$dir\\*\" \"$persist_dir\" -Include 'branding.dll', 'CCleaner.dat' -ErrorAction SilentlyContinue -Force",
    "post_uninstall": [
        "# Remove shortcut and shim",
        "rm_shim 'ccleaner' \"$(shimdir $global)\"",
        "Write-Host \"Removing shortcut $(friendly_path \"$(shortcut_folder $global)\\CCleaner.lnk\")\"",
        "Remove-Item \"$(shortcut_folder $global)\\CCleaner.lnk\" -Force -ErrorAction SilentlyContinue"
    ],
    "autoupdate": {
        "url": "https://download.ccleaner.com/portable/ccsetup$majorVersion$minorVersion.zip"
    }
}
