Compare commits

...

4 commits

Author SHA1 Message Date
kPherox b4d75f143a
feat: support create symlink (#783) 2026-08-24 18:41:42 +02:00
Paweł Lidwin 7490e78855
ci: exclude dev dependencies from zipapp packaging (#782)
it looks like ruff binary was being installed, inflating the size by a lot
2026-08-20 21:56:41 +02:00
CommandMC ece601bfb2
add wrapper exe support (#777)
(cherry picked from commit c9ff491c64fc336496973b3fea0e2373bbb0f9f0)

Co-authored-by: Etaash Mathamsetty <etaash.mathamsetty@gmail.com>
2026-08-20 15:48:08 +02:00
CommandMC 1be4b7e2ba
Set CWD when launching a title through the EA app (#776) 2026-08-09 21:27:39 +02:00
5 changed files with 36 additions and 5 deletions

View file

@ -80,7 +80,7 @@ jobs:
- run: mkdir -p build dist - run: mkdir -p build dist
- name: Dependencies - name: Dependencies
run: uv export --format requirements.txt --no-editable | uv pip install --requirement - --target build run: uv export --format requirements.txt --no-editable --no-dev | uv pip install --requirement - --target build
- run: cp zipapp_main.py build/__main__.py - run: cp zipapp_main.py build/__main__.py

View file

@ -687,15 +687,18 @@ class LegendaryCLI:
if args.json: if args.json:
return self._print_json(vars(params), args.pretty_json) return self._print_json(vars(params), args.pretty_json)
# Copying existing env vars is required on Windows, probably a good idea on Linux
full_env = os.environ.copy()
full_env.update(params.environment)
full_params = list() full_params = list()
full_params.extend(params.launch_command) full_params.extend(params.launch_command)
if 'LEGENDARY_WRAPPER_EXE' in full_env:
full_params.append(full_env['LEGENDARY_WRAPPER_EXE'].strip())
full_params.append(os.path.join(params.game_directory, params.game_executable)) full_params.append(os.path.join(params.game_directory, params.game_executable))
full_params.extend(params.game_parameters) full_params.extend(params.game_parameters)
full_params.extend(params.user_parameters) full_params.extend(params.user_parameters)
full_params.extend(params.egl_parameters) full_params.extend(params.egl_parameters)
# Copying existing env vars is required on Windows, probably a good idea on Linux
full_env = os.environ.copy()
full_env.update(params.environment)
if 'CX_BOTTLE' in full_env and any('SharedSupport/CrossOver' in p for p in params.launch_command): if 'CX_BOTTLE' in full_env and any('SharedSupport/CrossOver' in p for p in params.launch_command):
# if using crossover, unset WINEPREFIX # if using crossover, unset WINEPREFIX
@ -836,7 +839,7 @@ class LegendaryCLI:
logger.warning(f'Pre-launch command failed: {e!r}') logger.warning(f'Pre-launch command failed: {e!r}')
logger.debug(f'Opening URI with command: {shlex.join(command)}') logger.debug(f'Opening URI with command: {shlex.join(command)}')
subprocess.Popen(command, env=full_env) subprocess.Popen(command, env=full_env, cwd=full_env.get('WINEPREFIX', None))
def install_game(self, args): def install_game(self, args):
if not self.core.lgd.lock_installed(): if not self.core.lgd.lock_installed():

View file

@ -344,6 +344,10 @@ class DLManager(Process):
# skip unchanged and empty files # skip unchanged and empty files
if current_file.filename in mc.unchanged: if current_file.filename in mc.unchanged:
continue continue
elif current_file.symlink_target:
self.tasks.append(FileTask(current_file.filename, old_file=current_file.symlink_target,
flags=TaskFlags.CREATE_SYMLINK))
continue
elif not current_file.chunk_parts: elif not current_file.chunk_parts:
self.tasks.append(FileTask(current_file.filename, flags=TaskFlags.CREATE_EMPTY_FILE)) self.tasks.append(FileTask(current_file.filename, flags=TaskFlags.CREATE_EMPTY_FILE))
continue continue

View file

@ -205,6 +205,29 @@ class FileWorker(Process):
if j.flags & TaskFlags.CREATE_EMPTY_FILE: # just create an empty file if j.flags & TaskFlags.CREATE_EMPTY_FILE: # just create an empty file
open(full_path, 'a').close() open(full_path, 'a').close()
self.o_q.put(WriterTaskResult(success=True, **j.__dict__))
continue
if j.flags & TaskFlags.CREATE_SYMLINK:
if current_file:
logger.warning('Trying to create symlink without closing first!')
current_file.close()
current_file = None
try:
os.symlink(j.old_file, full_path)
except FileExistsError:
try:
os.remove(full_path)
os.symlink(j.old_file, full_path)
except OSError as e:
logger.error(f'Creating symlink failed: {e!r}')
self.o_q.put(WriterTaskResult(success=False, **j.__dict__))
continue
except OSError as e:
logger.error(f'Creating symlink failed: {e!r}')
self.o_q.put(WriterTaskResult(success=False, **j.__dict__))
continue
self.o_q.put(WriterTaskResult(success=True, **j.__dict__)) self.o_q.put(WriterTaskResult(success=True, **j.__dict__))
continue continue
elif j.flags & TaskFlags.OPEN_FILE: elif j.flags & TaskFlags.OPEN_FILE:

View file

@ -59,6 +59,7 @@ class TaskFlags(Flag):
CLOSE_FILE = auto() CLOSE_FILE = auto()
DELETE_FILE = auto() DELETE_FILE = auto()
CREATE_EMPTY_FILE = auto() CREATE_EMPTY_FILE = auto()
CREATE_SYMLINK = auto()
RENAME_FILE = auto() RENAME_FILE = auto()
RELEASE_MEMORY = auto() RELEASE_MEMORY = auto()
MAKE_EXECUTABLE = auto() MAKE_EXECUTABLE = auto()