Lines Matching defs:path
1212 _Py_wstat(const wchar_t* path, struct stat *buf)
1217 err = _wstat(path, &wstatbuf);
1223 fname = _Py_EncodeLocaleRaw(path, NULL);
1235 /* Call _wstat() on Windows, or encode the path to the filesystem encoding and
1242 _Py_stat(PyObject *path, struct stat *statbuf)
1248 const wchar_t *wpath = _PyUnicode_AsUnicode(path);
1250 wchar_t *wpath = PyUnicode_AsWideCharString(path, NULL);
1265 bytes = PyUnicode_EncodeFSDefault(path);
1390 /* fast-path: ioctl() only requires one syscall */
1392 * thus avoid using ioctl() so we skip the fast-path. */
1432 /* slow-path: fcntl() requires two syscalls */
1592 /* Open a file. Use _wfopen() on Windows, encode the path to the locale
1599 _Py_wfopen(const wchar_t *path, const wchar_t *mode)
1602 if (PySys_Audit("open", "uui", path, mode, 0) < 0) {
1614 cpath = _Py_EncodeLocaleRaw(path, NULL);
1621 f = _wfopen(path, mode);
1633 /* Open a file. Call _wfopen() on Windows, or encode the path to the filesystem
1647 _Py_fopen_obj(PyObject *path, const char *mode)
1657 if (PySys_Audit("open", "Osi", path, mode, 0) < 0) {
1660 if (!PyUnicode_Check(path)) {
1662 "str file path expected under Windows, got %R",
1663 Py_TYPE(path));
1667 const wchar_t *wpath = _PyUnicode_AsUnicode(path);
1669 wchar_t *wpath = PyUnicode_AsWideCharString(path, NULL);
1699 if (!PyUnicode_FSConverter(path, &bytes))
1703 if (PySys_Audit("open", "Osi", path, mode, 0) < 0) {
1721 PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, path);
1912 /* Read value of symbolic link. Encode the path to the locale encoding, decode
1918 _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t buflen)
1927 cpath = _Py_EncodeLocaleRaw(path, NULL);
1961 /* Return the canonicalized absolute pathname. Encode path to the locale
1967 _Py_wrealpath(const wchar_t *path,
1975 cpath = _Py_EncodeLocaleRaw(path, NULL);
2004 _Py_isabs(const wchar_t *path)
2008 HRESULT hr = PathCchSkipRoot(path, &tail);
2009 if (FAILED(hr) || path == tail) {
2012 if (tail == &path[1] && (path[0] == SEP || path[0] == ALTSEP)) {
2016 if (tail == &path[2] && path[1] == L':') {
2022 return (path[0] == SEP);
2027 /* Get an absolute path.
2033 _Py_abspath(const wchar_t *path, wchar_t **abspath_p)
2035 if (path[0] == '\0' || !wcscmp(path, L".")) {
2046 if (_Py_isabs(path)) {
2047 *abspath_p = _PyMem_RawWcsdup(path);
2052 return _PyOS_getfullpathname(path, abspath_p);
2062 size_t path_len = wcslen(path);
2081 memcpy(abspath, path, path_len * sizeof(wchar_t));
2127 /* Join the two paths together, like os.path.join(). Return NULL
2152 /* Join the two paths together, like os.path.join().
2155 relfile: this must be a relative path
2157 Return -1 if anything is wrong with the path lengths. */
2178 /* In-place path normalisation. Returns the start of the normalized
2179 path, which will be within the original buffer. Guaranteed to not
2180 make the path longer, and will not fail. 'size' is the length of
2181 the path, if known. If -1, the first null character will be assumed
2182 to be the end of the path. 'normsize' will be set to contain the
2183 length of the resulting normalized path. */
2185 _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
2187 assert(path != NULL);
2188 if ((size < 0 && !path[0]) || size == 0) {
2190 return path;
2192 wchar_t *pEnd = size >= 0 ? &path[size] : NULL;
2193 wchar_t *p1 = path; // sequentially scanned address in the path
2194 wchar_t *p2 = path; // destination of a scanned character to be ljusted
2195 wchar_t *minP2 = path; // the beginning of the destination range
2208 path = &path[2];
2209 while (IS_SEP(path) && !IS_END(path)) {
2210 path++;
2212 p1 = p2 = minP2 = path;
2245 minP2 = p2 - 1; // Absolute path has SEP at minP2
2270 // Relative path does not absorb ../ at minP2 as well.
2275 // Absolute path, so absorb segment
2301 *normsize = p2 - path + 1;
2305 return path;
2308 /* In-place path normalisation. Returns the start of the normalized
2309 path, which will be within the original buffer. Guaranteed to not
2310 make the path longer, and will not fail. 'size' is the length of
2311 the path, if known. If -1, the first null character will be assumed
2312 to be the end of the path. */
2314 _Py_normpath(wchar_t *path, Py_ssize_t size)
2317 return _Py_normpath_and_size(path, size, &norm_length);
2322 including the null character. Decode the path from the locale encoding.