[SOLVED] Deleting a directory in a user profile

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
Mikael_S
Messages: 26
Registration: Apr 25, 2023 - 11:57

May 31, 2024 - 11:41

WAPT 2.5.4.15342 Enterprise under Ubuntu
Windows 11

Hello,

I'm trying to create a package that would delete a directory located here:

C:\Users\XXX\AppData\Local\Programs

I tried using "def session_setup():" and parameters to retrieve the user:
user_appdata()
user_local_appdata()
get_current_user()

But I consistently end up using the "system" account.

I don't think it's complicated, but I'm not very familiar with scripting under WAPT; I've thoroughly reviewed the documentation, but perhaps I'm doing it incorrectly.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

May 31, 2024 - 11:48

Hello

, could you post your setup.py file?


Without the code, it's difficult to know what's wrong.
Mikael_S
Messages: 26
Registration: Apr 25, 2023 - 11:57

May 31, 2024 - 2:10 PM

To simplify my test and see how it works, I visualize the values ​​returned by the different commands I saw in the documentation, then I create a directory and see what happens

Code: Select all

def install():
        print(user_appdata())
        print(get_current_user())
        print(user_local_appdata())
        mkdirs(makepath(user_local_appdata,'TEST'))
        mkdirs(makepath(user_local_appdata,'TEST1'))
        mkdirs(makepath(user_appdata,'TEST2'))
pass
The result of the printouts:
C:\windows\system32\config\systemprofile\AppData\Roaming
System
C:\windows\system32\config\systemprofile\AppData\Local


And it does create the test folders, but not in the user's appdata folder
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

May 31, 2024 - 2:54 PM

`user_appdata()` is not available in `def install()`;

it will work in `session_setup`.

You must run the installer, then `session_setup` when you test (note that if you have already run `session_setup`, you will need to increment the version number in the `control` file with each test).
Locked