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


'''{
   "key":"Zotero 7.0.1 (x64 en-US)",
   "name":"Zotero",
   "version":"7.0.1",
   "install_date":"",
   "install_location":"C:\\Program Files\\Zotero",
   "uninstall_string":"C:\\Program Files\\Zotero\\uninstall\\helper.exe",
   "publisher":"Corporation for Digital Scholarship",
   "system_component":0,
   "win64":true
  }'''

def install():
    # Initializing variables
    bin_name = glob.glob('Zotero-*_x64_setup.exe')[0]
    version = bin_name.split('_')[0].rsplit('-')[-1]

    # Constructing the registry key
    reg_key = f"Zotero {version} (x64 en-US)"

    # Installing the package
    
    install_exe_if_needed(
        bin_name,
        silentflags='/s /allusers',
        key= reg_key,
        min_version=control.get_software_version()
    )
