MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / get_pg_home_directory

Function get_pg_home_directory

asyncpg/compat.py:26–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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
37else:
38 def get_pg_home_directory() -> pathlib.Path | None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…