MCPcopy Create free account
hub / github.com/openai/plugins / _create_file

Function _create_file

plugins/codex-security/scripts/windows_scan_local_files.py:280–304  ·  view source on GitHub ↗
(
    path: Path,
    *,
    access: int,
    share: int,
    disposition: int,
    flags: int,
    missing_ok: bool = False,
)

Source from the content-addressed store, hash-verified

278
279
280def _create_file(
281 path: Path,
282 *,
283 access: int,
284 share: int,
285 disposition: int,
286 flags: int,
287 missing_ok: bool = False,
288) -> _OwnedHandle | None:
289 _require_windows()
290 handle = _CreateFileW(
291 _extended_path(path),
292 access,
293 share,
294 None,
295 disposition,
296 flags,
297 None,
298 )
299 if handle == _INVALID_HANDLE_VALUE:
300 error = ctypes.get_last_error()
301 if missing_ok and error in _MISSING_ERRORS:
302 return None
303 _raise_last_error("CreateFileW", path)
304 return _OwnedHandle(int(handle))
305
306
307def _attributes(handle: int) -> _FileAttributeTagInfo:

Callers 5

_open_directoryFunction · 0.85
open_read_fdFunction · 0.85
atomic_writeFunction · 0.85
unlink_if_existsFunction · 0.85

Calls 4

_require_windowsFunction · 0.85
_extended_pathFunction · 0.85
_raise_last_errorFunction · 0.85
_OwnedHandleClass · 0.85

Tested by

no test coverage detected