Metadata-Version: 2.4
Name: mo2-vfs.py
Version: 1.0.0
Summary: Python workarounds for MO2's Universal Virtual Filesystem (UVFS) on Windows 11 24H2
Project-URL: Homepage, https://moddingforge.com
Project-URL: Repository, https://code.moddingforge.com/modding-forge/misc/mo2-vfs.py
Project-URL: Changelog, https://code.moddingforge.com/modding-forge/misc/mo2-vfs.py/-/blob/master/CHANGELOG.md
Author-email: Modding Forge <info@moddingforge.com>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# mo2-vfs.py

Python workarounds for MO2's Universal Virtual Filesystem (UVFS) on Windows 11 24H2.

Replaces broken stdlib functions (`Path.is_file`, `Path.is_dir`, `os.makedirs`,
`glob.glob`) with direct Win32 API calls via `ctypes`. No external dependencies.

See [ModOrganizer2/modorganizer#2174](https://github.com/ModOrganizer2/modorganizer/issues/2174)
for background.

---

## Installation

```bash
pip install mo2-vfs.py
```

---

## Usage

```python
import mo2_vfs

# Apply monkey-patches to os.makedirs and Path.is_file
mo2_vfs.patch_all()

# Direct API
mo2_vfs.is_file(path)
mo2_vfs.is_dir(path)
mo2_vfs.mkdir(path)           # creates parent dirs automatically
mo2_vfs.glob(path, "*.swf", recursive=True)

# Restore originals
mo2_vfs.unpatch_all()
```

---

## What is fixed

| Broken stdlib API | Replacement | Win32 API used |
|---|---|---|
| `Path.is_file()` | `mo2_uvfs.is_file()` | `GetFileAttributesW` |
| `Path.is_dir()` | `mo2_uvfs.is_dir()` | `GetFileAttributesW` |
| `os.makedirs()` / `Path.mkdir()` | `mo2_uvfs.mkdir()` | `CreateDirectoryW` |
| `glob.glob()` / `Path.glob()` | `mo2_uvfs.glob()` | `FindFirstFileW` / `FindNextFileW` |

---

## License

[MIT](LICENSE)
