# -*- coding: utf-8 -*-
from setuphelpers import *

def install():
    # Define local variables
    bin_name = glob.glob("D5_LiveSync_Sketchup*.exe")[0]

    # Install software
    install_exe_if_needed(
        bin_name,
        silentflags = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /ALLUSERS',
        min_version=control.version.split("-", 1)[0]
    )


def uninstall():
    # Define local variables
    uninstaller = makepath("C:", "ProgramData", "Microsoft", "Windows", "Start Menu", "Programs", "D5 LiveSync", "D5 LiveSync for SketchUp", "unins000.exe")

    # Uninstall
    if isfile(uninstaller):
        run(rf'"{uninstaller}" /VERYSILENT /SUPPRESSMSGBOXES')