This commit is contained in:
Bill Zissimopoulos
2015-12-31 22:53:17 -08:00
parent 8e2ed419f0
commit 223b287453
13 changed files with 391 additions and 2 deletions

56
src/dll/path.c Normal file
View File

@ -0,0 +1,56 @@
/**
* @file dll/path.c
*
* @copyright 2015 Bill Zissimopoulos
*/
#include <dll/library.h>
FSP_API VOID FspPathPrefix(PWSTR Path, PWSTR *PPrefix, PWSTR *PRemain)
{
PWSTR Pointer;
for (Pointer = Path; *Pointer; Pointer++)
if (L'\\' == *Pointer)
{
*Pointer++ = L'\0';
for (; L'\\' == *Pointer; Pointer++)
;
break;
}
*PPrefix = Path;
*PRemain = Pointer;
}
FSP_API VOID FspPathSuffix(PWSTR Path, PWSTR *PRemain, PWSTR *PSuffix)
{
PWSTR Pointer, RemainEnd, Suffix = 0;
for (Pointer = Path; *Pointer;)
if (L'\\' == *Pointer)
{
RemainEnd = Pointer++;
for (; L'\\' == *Pointer; Pointer++)
;
Suffix = Pointer;
}
else
Pointer++;
*PRemain = Path;
if (Path < Suffix)
{
*RemainEnd = L'\0';
*PSuffix = Suffix;
}
else
*PSuffix = Pointer;
}
FSP_API VOID FspPathCombine(PWSTR Prefix, PWSTR Suffix)
{
for (; Prefix < Suffix; Prefix++)
if (L'\0' == *Prefix)
*Prefix = L'\\';
}