Skip to content

Commit

Permalink
Merge pull request #57 from roblabla/linux-fixes
Browse files Browse the repository at this point in the history
Linux fixes
  • Loading branch information
roblabla authored Jan 6, 2024
2 parents 4d10153 + 0b6b409 commit 5d35edd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
22 changes: 17 additions & 5 deletions scripts/create_devenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ def msiextract(msi_file_path: Path, output_dir: Path) -> int:

for entry in dir.glob("*"):
new_entry = parent_dir / entry.name
shutil.move(str(entry), str(new_entry))
print(f"Renaming {entry} -> {new_entry}")
if not new_entry.exists():
shutil.move(str(entry), str(new_entry))
else:
copytree_exist_ok(str(entry), str(new_entry))
shutil.rmtree(str(entry))

dir.rmdir()

Expand All @@ -84,9 +89,16 @@ def msiextract(msi_file_path: Path, output_dir: Path) -> int:
new_entry = entry.parent / new_name

if entry != new_entry:
shutil.move(str(entry), str(new_entry))
renamed_something = True
break
print(f"Renaming {entry} -> {new_entry}")
if not new_entry.exists():
shutil.move(str(entry), str(new_entry))
renamed_something = True
break
else:
copytree_exist_ok(str(entry), str(new_entry))
shutil.rmtree(str(entry))
renamed_something = True
break

should_continue = renamed_something

Expand Down Expand Up @@ -297,7 +309,7 @@ def install_compiler_sdk(installer_path, tmp_dir, tmp2_dir, output_path):

shutil.rmtree(str(tmp2_dir), ignore_errors=True)

# Unifromalise everything
# Uniformalize everything
should_continue = True
while should_continue:
renamed_something = False
Expand Down
2 changes: 1 addition & 1 deletion scripts/create_th06_prefix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_function_decompme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
7 changes: 5 additions & 2 deletions scripts/winhelpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os
from pathlib import Path
import subprocess
import sys

SCRIPTS_DIR = Path(__file__).parent


def run_windows_program(args, add_env=None, cwd=None):
env = dict(os.environ)
Expand All @@ -12,13 +15,13 @@ def run_windows_program(args, add_env=None, cwd=None):
if sys.platform == "win32":
subprocess.check_call(args, env=env, cwd=cwd)
else:
subprocess.check_call([os.getenv("WINE", "wine")] + args, env=env, cwd=cwd)
subprocess.check_call([str(SCRIPTS_DIR / "wineth06")] + args, env=env, cwd=cwd)


def get_windows_path(path):
if sys.platform == "win32":
return str(path)
else:
return subprocess.check_output(
[os.getenv("WINE", "wine"), "winepath", "-w", str(path)], text=True
[str(SCRIPTS_DIR / "wineth06"), "winepath", "-w", str(path)], text=True
).strip()

0 comments on commit 5d35edd

Please sign in to comment.