Announcement

Collapse
No announcement yet.

Path of installation folder in c:\users\name\appdata\local

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Path of installation folder in c:\users\name\appdata\local

    When making an installer I want Setup Factory to copy a folder to the location c: \ users \ name \ AppData \ Local, but I can't do it from the program options, I'm not a programmer, so far I have been able to make installers to other locations but not to that location, whatever I put, I get a message saying that the folder cannot be created.

  • #2
    You did not show the Lua code you are using, which makes answering your question more difficult than it could be.

    You might be forgetting to escape the backslashes in the path properly, for example - this could easily cause the error message you mention. I suggest that you read the User's Guide, so you understand how to work with files, paths and session variables.

    Here is an example script for copying a file into a new folder created in the user's local application data folder.

    Code:
    -- Save the LOCALAPPDATA folder path in a session variable
    SessionVar.Set("%LocalAppDataFolder%", Shell.GetFolder(SHF_APPLICATIONDATA_LOCAL));
    
    -- define the name of the target folder
    local sTargetFolderName = SessionVar.Expand("%LocalAppDataFolder%\\My Folder Name");
    
    -- create a folder in LOCALAPPDATA
    Folder.Create(sTargetFolderName);
    
    -- copy a file to LOCALAPPDATA (the target folder must already exist for this to work)
    File.Copy("full-path-to-source-file-name.ext", sTargetFolderName);
    And in case you are attempting to set the local application data folder as the target in the IDE, this is how you would do it:
    • Define the session variable in the On Startup event script
    • Set the target folder for the desired files as needed
    Click image for larger version

Name:	SCRN-2020-12-28-01.png
Views:	342
Size:	25.9 KB
ID:	305891

    If this does not help, even after reading the documentation I suggested, please post your project and the error message you receive.

    Ulrich
    Last edited by Ulrich; 12-28-2020, 06:37 PM.

    Comment

    Working...
    X