/** * @brief Delete a file * If filename is a link, the link itself it removed. */ int _win_unlink(const char *filename) { char szFile[_MAX_PATH + 1]; long lRet; if ((lRet = plibc_conv_to_win_path_ex(filename, szFile, 0)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; } /* unlink sets errno */ return unlink(szFile); }
/** * @brief Delete a file * If filename is a link, the link itself it removed. */ int _win_unlink(const char *filename) { wchar_t szFile[_MAX_PATH + 1]; long lRet; if (plibc_utf8_mode() == 1) lRet = plibc_conv_to_win_pathwconv_ex(filename, szFile, 0); else lRet = plibc_conv_to_win_path_ex(filename, (char *) szFile, 0); if (lRet != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; } /* unlink sets errno */ if (plibc_utf8_mode() == 1) return _wunlink(szFile); else return unlink((char *) szFile); }
/** * @brief Convert a POSIX-sytle path to a Windows-style path * @param pszUnix POSIX path * @param pszWindows Windows path * @return Error code from winerror.h, ERROR_SUCCESS on success */ int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows) { return plibc_conv_to_win_path_ex(pszUnix, pszWindows, 1); }