pyusvfs/main.py

36 lines
1010 B
Python
Raw Permalink Normal View History

2024-08-07 14:10:57 +00:00
from pathlib import Path
import usvfs as usvfs_p
usvfs = usvfs_p.USVFS("./usvfs_x64.dll")
print(f"USVFS version: {usvfs.version()}")
parameters = usvfs.make_parameters()
parameters.instance_name = "instance"
parameters.debug_mode = False
parameters.log_level = usvfs_p.LogLevel.Debug
parameters.crash_dumps_type = usvfs_p.CrashDumpType.Off
parameters.crash_dumps_path = ""
filesystem = usvfs.make_virtual_filesystem()
filesystem.link_directory("./virtual", "./data", recursive=True)
usvfs.connect_virtual_filesystem(parameters, filesystem)
usvfs.run_hooked_process(R"cmd.exe /C dir .\data\subvirtual", cwd=Path())
usvfs.run_hooked_process(
R"C:\Users\MikaelCAPELLE\.envs\MO2\Scripts\python.exe list-nt-query.py .\data\subvirtual",
cwd=Path(),
)
usvfs.run_hooked_process(
R'''python -c "from pathlib import Path; print(list(Path('data').glob('**/*')))"'''
)
with open("usvfs.log", "w") as fp:
fp.write("\n".join(usvfs.get_log_messages()) + "\n")
usvfs.disconnect_virtual_filesystem()