0 votes

My program should do a self-update, but I can't replace the .pck file.
I tried HTTPRequest.download_file, Directory. replace and Directory.rename and renaming it just before quitting.

It already worked with the HTTP request, but I don't know why. (I think it might be because of the file size).

Unfortunately it doesn't work now.

I hope someone has an idea.

in Engine by (225 points)
edited by

1 Answer

+1 vote
Best answer

On Windows, you won't be able to replace the EXE and PCK file while the project is running due to Windows' file locking limitations. However, you should be able to move those files to %TEMP% where these files can be cleaned automatically by the Disk Cleaner program when the user runs low on disk space.

You can get the path to Windows' temporary data folder using OS.get_environment("TEMP").

PS: Implementing self-update is a complex process with security implications (such as ensuring the use of secure connections and signing releases). Consider using Steam or itch.io to handle this instead, rather than implementing your own self-update solution which may contain security holes.

by (12,835 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.