Problem during file copy

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Louis
Messages: 4
Registration: May 20, 2021 - 2:03 p.m.

May 20, 2021 - 2:18 PM

Good morning !

I am currently packaging LibreOffice for my company, with some features that I have added to the LibreOffice configuration files located in the Roaming.

I would like my pre-configured "LibreOffice" file to be moved from the package to my user directory during the installation of my package. I therefore made a copy of the file located in the package to the root of my PC.

then with the def session setup(): I move it into the file usersUnfortunately, it doesn't work, and I've been racking my brains for a while now without finding a solution.

The copy doesn't even go to the PC's root directory, so it's impossible to move it to the user folder.

Here is my code:

Code: Select all

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)
Louis
Messages: 4
Registration: May 20, 2021 - 2:03 p.m.

May 26, 2021 - 2:43 PM

If someone could give me an answer, that would be amazing, thank you!
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

June 1, 2021 - 10:03 PM

Based on the line `copytree2('LibreOffice','C:\Program Files (x86)')`, it doesn't seem to me that the LibreOffice folder is being copied to the root directory. Is it actually located there or not?
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked