()
| 24 | CSIDL_APPDATA: typing.Final = 0x001a |
| 25 | |
| 26 | def get_pg_home_directory() -> pathlib.Path | None: |
| 27 | # We cannot simply use expanduser() as that returns the user's |
| 28 | # home directory, whereas Postgres stores its config in |
| 29 | # %AppData% on Windows. |
| 30 | buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) |
| 31 | r = ctypes.windll.shell32.SHGetFolderPathW(0, CSIDL_APPDATA, 0, 0, buf) |
| 32 | if r: |
| 33 | return None |
| 34 | else: |
| 35 | return pathlib.Path(buf.value) / 'postgresql' |
| 36 | |
| 37 | else: |
| 38 | def get_pg_home_directory() -> pathlib.Path | None: |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…