diff --git a/desktop_env/server/main.py b/desktop_env/server/main.py index f782781..9ed1295 100644 --- a/desktop_env/server/main.py +++ b/desktop_env/server/main.py @@ -45,6 +45,11 @@ def execute_command(): if isinstance(command, str) and not shell: command = shlex.split(command) + # Expand user directory + for i, arg in enumerate(command): + if arg.startswith("~/"): + command[i] = os.path.expanduser(arg) + # Execute the command without any safety checks. try: result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, text=True) @@ -82,6 +87,11 @@ def launch_app(): if isinstance(command, str) and not shell: command = shlex.split(command) + # Expand user directory + for i, arg in enumerate(command): + if arg.startswith("~/"): + command[i] = os.path.expanduser(arg) + try: if 'google-chrome' in command and _get_machine_architecture() == 'arm': index = command.index('google-chrome')