Convert a ton of things over to fextl

This commit is contained in:
Ryan Houdek committed 2023-03-30 16:28:33 -07:00
1 parent 465ecd9b19
commit 1eb36b8b31
56 files changed
+273 -175

No files matched your search

@@ -1,13 +1,14 @@
#pragma once
#include <FEXCore/fextl/string.h>
#include <fcntl.h>
#include <string>
#include <sys/stat.h>
#include <span>
#include <unistd.h>
namespace FHU::Symlinks {
// Checks to see if a filepath is a symlink.
inline bool IsSymlink(const std::string &Filename) {
inline bool IsSymlink(const fextl::string &Filename) {
struct stat Buffer{};
int Result = lstat(Filename.c_str(), &Buffer);
return Result == 0 && S_ISLNK(Buffer.st_mode);
@@ -17,7 +18,7 @@ inline bool IsSymlink(const std::string &Filename) {
// Doesn't handle recursive symlinks.
// Doesn't append null terminator character.
// Returns a string_view of the resolved path, or an empty view on error.
inline std::string_view ResolveSymlink(const std::string &Filename, std::span<char> ResultBuffer) {
inline std::string_view ResolveSymlink(const fextl::string &Filename, std::span<char> ResultBuffer) {
ssize_t Result = readlink(Filename.c_str(), ResultBuffer.data(), ResultBuffer.size());
if (Result == -1) {
return {};