102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
path.c File Reference
#include <dttr_path.h>
#include <string.h>
#include <windows.h>

Go to the source code of this file.

Functions

static bool copy_path_value (char *out, size_t out_size, const char *value, size_t value_len, bool allow_empty)
static const char * skip_dot_separators (const char *path)
static void trim_trailing_separators (sds path)
char DTTR_Path_AsciiLower (char ch)
bool DTTR_Path_AsciiIeqN (const char *lhs, const char *rhs, size_t n)
bool DTTR_Path_CopyString (char *out, size_t out_size, const char *value)
bool DTTR_Path_CopySds (char *out, size_t out_size, sds value)
bool DTTR_Path_IsSeparator (char ch)
const char * DTTR_Path_SkipSeparators (const char *path)
size_t DTTR_Path_SegmentLen (const char *path)
bool DTTR_Path_IsRelativeSegment (const char *segment, size_t segment_len)
static bool path_has_windows_drive_prefix (const char *path)
bool DTTR_Path_IsSafeRelative (const char *path)
static sds normalize_path_for_compare (const char *path)
bool DTTR_Path_MatchesNormalized (const char *lhs, const char *rhs)
bool DTTR_Path_IsWindowsAbsolute (const char *path)
bool DTTR_Path_IsAnyAbsolute (const char *path)
bool DTTR_Path_ExactExists (const char *path)
sds DTTR_Path_CurrentDir ()
sds DTTR_Path_ModuleDir (void *module)
sds DTTR_Path_ModuleSibling (void *module, const char *relative_path)
sds DTTR_Path_ResolveRelativeTo (const char *base_dir, const char *path)
sds DTTR_Path_NativeRoot (const char *path, const char **rest)
bool DTTR_Path_AppendChar (sds *path, char ch)
bool DTTR_Path_AppendSeparator (sds *path, char separator)
bool DTTR_Path_AppendSegment (sds *path, const char *segment, char separator)

Function Documentation

◆ copy_path_value()

bool copy_path_value ( char * out,
size_t out_size,
const char * value,
size_t value_len,
bool allow_empty )
static

Definition at line 7 of file path.c.

Referenced by DTTR_Path_CopySds(), and DTTR_Path_CopyString().

◆ DTTR_Path_AppendChar()

bool DTTR_Path_AppendChar ( sds * path,
char ch )

◆ DTTR_Path_AppendSegment()

◆ DTTR_Path_AppendSeparator()

bool DTTR_Path_AppendSeparator ( sds * path,
char separator )

Definition at line 272 of file path.c.

References DTTR_Path_AppendChar().

Referenced by DTTR_ISO_CachePathForFile(), and set_dump_dir().

◆ DTTR_Path_AsciiIeqN()

bool DTTR_Path_AsciiIeqN ( const char * lhs,
const char * rhs,
size_t n )

◆ DTTR_Path_AsciiLower()

char DTTR_Path_AsciiLower ( char ch)

Definition at line 50 of file path.c.

Referenced by DTTR_Path_AsciiIeqN(), and sdscat_lower_segment().

◆ DTTR_Path_CopySds()

◆ DTTR_Path_CopyString()

bool DTTR_Path_CopyString ( char * out,
size_t out_size,
const char * value )

◆ DTTR_Path_CurrentDir()

sds DTTR_Path_CurrentDir ( )

Definition at line 191 of file path.c.

References DWORD, and NULL.

Referenced by DTTR_Path_NativeRoot().

◆ DTTR_Path_ExactExists()

bool DTTR_Path_ExactExists ( const char * path)

◆ DTTR_Path_IsAnyAbsolute()

bool DTTR_Path_IsAnyAbsolute ( const char * path)

◆ DTTR_Path_IsRelativeSegment()

bool DTTR_Path_IsRelativeSegment ( const char * segment,
size_t segment_len )

◆ DTTR_Path_IsSafeRelative()

◆ DTTR_Path_IsSeparator()

◆ DTTR_Path_IsWindowsAbsolute()

bool DTTR_Path_IsWindowsAbsolute ( const char * path)

Definition at line 175 of file path.c.

References DTTR_Path_IsSeparator().

Referenced by DTTR_Path_IsAnyAbsolute(), DTTR_Path_NativeRoot(), and resolve_stream_path().

◆ DTTR_Path_MatchesNormalized()

bool DTTR_Path_MatchesNormalized ( const char * lhs,
const char * rhs )

Definition at line 165 of file path.c.

References normalize_path_for_compare().

Referenced by DTTR_Config_FieldChanged().

◆ DTTR_Path_ModuleDir()

sds DTTR_Path_ModuleDir ( void * module)

Definition at line 201 of file path.c.

References DWORD, and NULL.

Referenced by DTTR_Path_ModuleSibling(), get_loader_dir(), resolve_loader_dir(), and set_mods_dir_from_config_path().

◆ DTTR_Path_ModuleSibling()

sds DTTR_Path_ModuleSibling ( void * module,
const char * relative_path )

◆ DTTR_Path_NativeRoot()

sds DTTR_Path_NativeRoot ( const char * path,
const char ** rest )

◆ DTTR_Path_ResolveRelativeTo()

sds DTTR_Path_ResolveRelativeTo ( const char * base_dir,
const char * path )

◆ DTTR_Path_SegmentLen()

◆ DTTR_Path_SkipSeparators()

◆ normalize_path_for_compare()

sds normalize_path_for_compare ( const char * path)
static

◆ path_has_windows_drive_prefix()

bool path_has_windows_drive_prefix ( const char * path)
static

Definition at line 103 of file path.c.

Referenced by DTTR_Path_IsSafeRelative().

◆ skip_dot_separators()

const char * skip_dot_separators ( const char * path)
static

Definition at line 23 of file path.c.

References DTTR_Path_IsSeparator().

Referenced by normalize_path_for_compare().

◆ trim_trailing_separators()

void trim_trailing_separators ( sds path)
static

Definition at line 31 of file path.c.

References DTTR_Path_IsSeparator().

Referenced by normalize_path_for_compare().