Make path api more understandable, breaks certain code and have makeabsolute and makerelative

This commit is contained in:
2025-04-19 10:24:24 -05:00
parent 3fcd7f81d6
commit 4ec4011b46
8 changed files with 161 additions and 4 deletions

View File

@ -53,4 +53,14 @@ namespace Tesses::Framework::Crypto
static std::vector<uint8_t> ComputeHash(Tesses::Framework::Streams::Stream* strm,bool is384=false);
static std::vector<uint8_t> ComputeHash(Tesses::Framework::Streams::Stream& strm,bool is384=false);
};
typedef enum {
VERSION_SHA1=1,
VERSION_SHA224=224,
VERSION_SHA256=256,
VERSION_SHA384=384,
VERSION_SHA512=512
} ShaVersion;
bool PBKDF2(std::vector<uint8_t>& output,std::string pass, std::vector<uint8_t>& salt, long itterations, ShaVersion version);
bool RandomBytes(std::vector<uint8_t>& output, std::string personal_str);
}

View File

@ -34,4 +34,5 @@ namespace Tesses::Framework::Filesystem
void GetDate(VFSPath path, time_t& lastWrite, time_t& lastAccess);
void SetDate(VFSPath path, time_t lastWrite, time_t lastAccess);
};
extern LocalFilesystem LocalFS;
}

View File

@ -9,7 +9,7 @@ namespace Tesses::Framework::Filesystem
{
class VFSPath {
public:
static VFSPath RelativeCurrentDirectory();
static VFSPath CurrentDirectoryAsRelative();
bool relative;
static std::vector<std::string> SplitPath(std::string path);
std::vector<std::string> path;
@ -29,6 +29,14 @@ namespace Tesses::Framework::Filesystem
void ChangeExtension(std::string ext);
void RemoveExtension();
std::string ToString();
static VFSPath GetAbsoluteCurrentDirectory();
static void SetAbsoluteCurrentDirectory(VFSPath path);
VFSPath MakeAbsolute();
VFSPath MakeAbsolute(VFSPath curDir);
VFSPath MakeRelative();
VFSPath MakeRelative(VFSPath toMakeRelativeTo);
};
VFSPath operator/(VFSPath p, VFSPath p2);
VFSPath operator/(VFSPath p, std::string p2);