mirror of
https://github.com/derrod/legendary.git
synced 2026-08-30 02:34:49 +00:00
Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4d75f143a | ||
|
|
7490e78855 | ||
|
|
ece601bfb2 | ||
|
|
1be4b7e2ba |
2
.github/workflows/build-base.yml
vendored
2
.github/workflows/build-base.yml
vendored
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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():
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue