9#ifndef HPP_ALIB_LANG_SYSTEM_PATH
10#define HPP_ALIB_LANG_SYSTEM_PATH 1
17namespace alib {
namespace lang::system {
24#if !defined(ALIB_PATH_CHARACTERS_WIDE)
26# define ALIB_PATH_CHARACTERS_WIDE 1
28 "Compiler symbol ALIB_PATH_CHARACTERS_WIDE wrongly detected: 1 but std::filesystem::path::value_type does not equal characters::wchar.");
30# define ALIB_PATH_CHARACTERS_WIDE 0
32 "Compiler symbol ALIB_PATH_CHARACTERS_WIDE wrongly detected: 0 but std::filesystem::path::value_type does not equal characters::nchar.");
35# if ALIB_PATH_CHARACTERS_WIDE
37 "Given compiler symbol ALIB_PATH_CHARACTERS_WIDE mismatch: Given 1 but std::filesystem::path::value_type does not equal characters::wchar.");
40 "Given compiler symbol ALIB_PATH_CHARACTERS_WIDE mismatch: Given 0 but std::filesystem::path::value_type does not equal characters::nchar.");
44#if ALIB_PATH_CHARACTERS_WIDE
45# define A_PATH(literal) L##literal
47# define A_PATH(literal) literal
50#if ALIB_CHARACTERS_WIDE == ALIB_PATH_CHARACTERS_WIDE
51# define ALIB_PATH_TO_STRING( src,dest,bufSize ) decltype(src)& dest(src);
52# define ALIB_PATH_TO_STRING_ARG( src,bufSize ) src;
53# define ALIB_STRING_TO_PATH( src,dest,bufSize ) decltype(src)& dest(src);
54# define ALIB_STRING_TO_PATH_ARG( src,bufSize ) src;
56# define ALIB_PATH_TO_STRING( src,dest,bufSize ) alib::strings::TLocalString<alib::characters::character ,bufSize> dest(src);
57# define ALIB_PATH_TO_STRING_ARG( src,bufSize ) alib::strings::TLocalString<alib::characters::character ,bufSize>(src);
58# define ALIB_STRING_TO_PATH( src,dest,bufSize ) alib::strings::TLocalString<alib::lang::system::PathCharType ,bufSize> dest(src);
59# define ALIB_STRING_TO_PATH_ARG( src,bufSize ) alib::strings::TLocalString<alib::lang::system::PathCharType ,bufSize>(src);
62#if !ALIB_PATH_CHARACTERS_WIDE
63# define ALIB_PATH_TO_NARROW( src,dest,bufSize ) decltype(src)& dest(src);
64# define ALIB_PATH_TO_NARROW_ARG( src,bufSize ) src;
66# define ALIB_PATH_TO_NARROW( src,dest,bufSize ) alib::strings::TLocalString<alib::characters::nchar, bufSize> dest(src);
67# define ALIB_PATH_TO_NARROW_ARG( src,bufSize ) alib::strings::TLocalString<alib::characters::nchar, bufSize>(src);
97#if !defined( _WIN32 ) || DOXYGEN
107#if defined(__APPLE__)
111 void ALIB_APPLE_OC_NSTemporaryDirectory(
Path& target );
112 void ALIB_APPLE_OC_NSHomeDirectory (
Path& target );
398 if( slashSlashPos > 0 )
399 return int(slashSlashPos + 2);
419namespace characters {
Path(const PathString &path)
static int IsAbsolute(const PathString &path)
ALIB_API bool Change(const PathString &path)
Path & Add(const PathString &dirOrFilename)
Path(SystemFolders special)
static PathString tempDirEvaluatedOnce
ALIB_API SystemErrors Create()
ALIB_API SystemErrors MakeReal()
Path(SystemFolders special, const PathString &fileName)
ALIB_API void AddModuleName(const PathString &extension)
void Change(SystemFolders special, const PathString &fileName)
static PathString varTempDirEvaluatedOnce
ALIB_API bool IsDirectory()
constexpr const TChar * Terminate() const
integer IndexOf(TChar needle, integer startIdx=0) const
TChar CharAt(integer idx) const
constexpr integer Length() const
TChar CharAtStart() const
PathCharType CharAtEnd() const
ALIB_WARNINGS_RESTORE integer LastIndexOf(PathCharType needle, integer startIndex=MAX_LEN) const
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
#define ATMP_EQ( T, TEqual)
@ Current
The current directory of the process.
@ Home
The user's home directory.
@ Module
The directory of the executable of the process.
@ Root
The root directory .
static constexpr PathString EMPTY_PATH
An empty path string.
static constexpr PathString NULL_PATH
A nulled path string.
SystemErrors
Denotes result values returned by system functions (glibc, etc).
std::filesystem::path::value_type PathCharType
static constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
strings::TSubstring< character > Substring
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
static const TChar * Buffer(const TString &src)
static integer Length(const TString &src)