Is it possible to check if a game is run with admin privileges (and if so, request them?)
I can't find anything in OS
or Engine
.
Checking for admin privileges?
- Edited
@kow__ said: Is it possible to check if a game is run with admin privileges (and if so, request them?) I can't find anything in
OS
orEngine
.
No. Engine runs on different level than OS. Checking or asking for admin privileges will require some Windows account stuff put inside core and I'm most certain it will break multi platform side of engine. If you want to read/write something runtime you should use res://path
to access resources folder or user://path
to access user folder (usually somewhere in documents or appdata folder). But res://path
is writable only from editor. Use user://path
on build, this is why we have it.
Please refer to this page for details about file system.
Have luck with your project. Garrom out.
Thanks, I just needed it to check if something was possible. I'll try to find a workaround.
On Windows, you could use OS.execute()
to run a PowerShell script that elevates to Administrator and does stuff you need to do as Administrator. However, you won't be able to interact with it while it's running. Also, keep in mind it will spawn an UAC prompt when requesting administrator privileges.
@Calinou said: On Windows, you could use
OS.execute()
to run a PowerShell script that elevates to Administrator and does stuff you need to do as Administrator. However, you won't be able to interact with it while it's running. Also, keep in mind it will spawn an UAC prompt when requesting administrator privileges.
I guess he was talking about build executable.