Rev 9377 | Rev 9382 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9377 | Rev 9381 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | from lib.platform import is_win32, path |
15 | from lib.platform import is_win32, path |
16 | from lib.logging import log |
16 | from lib.logging import log |
17 | from lib.network import download |
17 | from lib.network import download |
Line 18... | Line 18... | ||
18 | 18 | ||
19 | # TODO: Move into _tools/lib |
- | |
20 | def get_file_directory(path): |
- | |
21 | path = path.replace("\\", "/") |
- | |
22 | if "/" in path: |
- | |
23 | folder = "/".join(path.split("/")[:-1]) |
- | |
24 | if folder == "": |
- | |
25 | return "/" # It was a file in the root folder |
- | |
26 | return folder |
- | |
27 | else: |
- | |
28 | return "." # Just a filename, let's return current folder |
- | |
29 | - | ||
30 | # TODO: Move into _tools/lib |
19 | # TODO: Move into _tools/lib |
31 | def run_qemu(start_dir = "workspace"): |
20 | def run_qemu(start_dir = "workspace"): |
32 | qemu_command = f"qemu-system-i386" |
21 | qemu_command = f"qemu-system-i386" |
33 | flags = "" |
22 | flags = "" |
34 | flags += "-L . " # IDK why it does not work without this |
23 | flags += "-L . " # IDK why it does not work without this |
Line 37... | Line 26... | ||
37 | flags += "-vga vmware " |
26 | flags += "-vga vmware " |
38 | flags += "-net nic,model=rtl8139 -net user " |
27 | flags += "-net nic,model=rtl8139 -net user " |
39 | flags += "-soundhw ac97 " |
28 | flags += "-soundhw ac97 " |
40 | if is_win32(): |
29 | if is_win32(): |
41 | qemu_full_path = shutil.which(qemu_command) |
30 | qemu_full_path = shutil.which(qemu_command) |
42 | qemu_directory = get_file_directory(qemu_full_path) |
31 | qemu_directory = os.path.dirname(qemu_full_path) |
43 | flags += f"-L {qemu_directory} " |
32 | flags += f"-L {qemu_directory} " |
44 | s = f"{qemu_command} {flags}" |
33 | s = f"{qemu_command} {flags}" |
45 | qemu_stdout = open(f"{start_dir}/qemu_stdout.log", "w") |
34 | qemu_stdout = open(f"{start_dir}/qemu_stdout.log", "w") |
46 | qemu_stderr = open(f"{start_dir}/qemu_stderr.log", "w") |
35 | qemu_stderr = open(f"{start_dir}/qemu_stderr.log", "w") |
47 | if is_win32(): |
36 | if is_win32(): |