{
    "version": "2.2.1.4",
    "description": "Cross-platform 2D CAD program.",
    "homepage": "https://librecad.org",
    "license": {
        "identifier": "GPL-2.0-only",
        "url": "https://github.com/LibreCAD/LibreCAD/blob/HEAD/LICENSE"
    },
    "notes": [
        "To register file associations, please execute the following command:",
        "reg import \"$dir\\install-associations.reg\""
    ],
    "suggest": {
        "vcredist": "extras/vcredist2022"
    },
    "architecture": {
        "64bit": {
            "url": "https://github.com/LibreCAD/LibreCAD/releases/download/v2.2.1.4/LibreCAD-v2.2.1.3-12-gd1ca469c9-win64-msvc.exe#/dl.7z",
            "hash": "c6e1ddfa67c24539f3bbb41f5614f6f0d9a30da4c94bfff1c4305ddb9fde5f76"
        },
        "32bit": {
            "url": "https://github.com/LibreCAD/LibreCAD/releases/download/v2.2.1.4/LibreCAD-v2.2.1.3-12-gd1ca469c9-msvc.exe#/dl.7z",
            "hash": "8547c4e7f8ce74a7c8bdf9b4b0e01546173cc097ee77a02781312d5ff3e8c45a"
        }
    },
    "pre_install": [
        "'$*', 'Uninst*', 'vc_redist*' | ForEach-Object {",
        "    Remove-Item -Path \"$dir\\$_\" -Recurse -Force -ErrorAction SilentlyContinue",
        "}"
    ],
    "post_install": [
        "$librecad_dir = $dir -replace '\\\\', '\\\\'",
        "Get-ChildItem -Path \"$bucketsdir\\$bucket\\scripts\\$app\" -Filter '*.reg' -File | ForEach-Object {",
        "    $content = Get-Content -Path $_.FullName -Encoding utf8",
        "    if ($global) { $content = $content -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE' }",
        "    $content -replace '{{librecad_dir}}', $librecad_dir | Set-Content -Path \"$dir\\$($_.Name)\" -Encoding unicode",
        "}"
    ],
    "bin": "LibreCAD.exe",
    "shortcuts": [
        [
            "LibreCAD.exe",
            "LibreCAD"
        ]
    ],
    "uninstaller": {
        "script": [
            "if ($cmd -eq 'uninstall') {",
            "    Get-ChildItem -Path $dir -Filter 'un*.reg' -File | ForEach-Object {",
            "        $registry_file = '\"{0}\"' -f $_.FullName",
            "        Start-Process -FilePath 'reg.exe' -ArgumentList @('import', $registry_file) -WindowStyle Hidden -Wait",
            "    }",
            "}"
        ]
    },
    "checkver": {
        "github": "https://api.github.com/repos/LibreCAD/LibreCAD/releases/latest",
        "jsonpath": "$.assets[?(@.name =~ /win/i)].browser_download_url",
        "regex": "(?i)download/(?<tag>v?([\\d.]+))/LibreCAD-(?<string>v?[\\d.-]+[+-]g\\w+)?-win"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://github.com/LibreCAD/LibreCAD/releases/download/$matchTag/LibreCAD-$matchString-win64-msvc.exe#/dl.7z"
            },
            "32bit": {
                "url": "https://github.com/LibreCAD/LibreCAD/releases/download/$matchTag/LibreCAD-$matchString-msvc.exe#/dl.7z"
            }
        }
    }
}
