Attualmente sto confezionando LibreOffice per la mia azienda, con alcune funzionalità che ho aggiunto ai file di configurazione di LibreOffice che si trovano in Il roaming.
Vorrei che il mio file "LibreOffice" preconfigurato venisse spostato dal pacchetto alla mia directory utente durante l'installazione del pacchetto. Ho quindi creato una copia del file presente nel pacchetto nella directory principale del mio PC.
poi con il def configurazione sessione(): Lo sposto nel file utentiPurtroppo non funziona e da un po' di tempo ci sto scervellando senza trovare una soluzione.
La copia non viene nemmeno salvata nella directory principale del PC, quindi è impossibile spostarla nella cartella utente.
Ecco il mio codice:
Codice: Seleziona tutto
def install():
copytree2('LibreOffice','C:\Program Files (x86)')
argument = {}
if not installed_softwares('Microsoft Office'):
argument = {'SELECT_WORD':1,'SELECT_EXCEL':1,'SELECT_POWERPOINT':1,'CREATEDESKTOPLINK':0,'RebootYesNo':'No','ALLUSER':1,'ISCHECKFORPRODUCTUPDATES':0,'QUICKSTART':0}
else:
argument = {'CREATEDESKTOPLINK':0,'RebootYesNo':'No','ALLUSER':1,'ISCHECKFORPRODUCTUPDATES':0,'QUICKSTART':0}
install_msi_if_needed('LibreOffice_7.0.5_Win_x64.msi',properties=argument)
# Suppression des raccourcis
for wrongshortcutname in wrongshortcutnames:
remove_desktop_shortcut(wrongshortcutname)
remove_programs_menu_shortcut(wrongshortcutname)
if isdir(makepath(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs', wrongshortcutname)):
remove_tree(makepath(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs', wrongshortcutname))
# Creation du raccourci dans le bon dossier
if not matiere == '':
if default_target != '':
target = default_target
else:
softs = get_softs()
if len(softs) > 0:
if (softs[0]['install_location'] == ''):
raise Exception('install_location', 'Impossible de trouver le dossier d\'installation, veuillez remplir la variable default_target')
target = makepath(softs[0]['install_location'], tasks_to_kill[0])
if not isfile(target):
raise Exception('target', 'Impossible de trouver l\'executable pour creer le raccourci')
create_programs_menu_shortcut(shortcutname, target=target, folder=matiere)
def session_setup():
copytree2('C:\Program Files (x86)\LibreOffice',makepath(user_appdata(),'LibreOffice'),onreplace=default_overwrite)
