21#if !defined ( _WIN32 )
31 int perms= int(
Value().Perms());
34 static_assert( int(FInfo::Permissions::OWNER_READ ) == 0400 &&
43 "This method is not compatible due to changes in the permission enumeration." );
47 char chars[3] = {
'r',
'w',
'x'};
52 result[charIdx]= perms & bit ? chars[charIdx % 3] :
'-';
56 target << NString(const_cast<const char*>(result), 9);
104 auto& value=
Value();
114 case 'a' : toBeAdded=
Name();
break;
115 case 's' : toBeAdded=
Stem();
break;
116 case 'e' : toBeAdded=
Extension();
break;
123 pathBuffer <<
Name();
125 toBeAdded= pathBuffer;
131 "Format Error: Token 'n' followed by unknown specifier {!Q'} in File::Format.", c )
132 target <<
"Format Error: Token 'n' followed by unknown specifier '" << c <<
"' in File::Format.";
142 toBeAdded= strBuffer;
149 else toBeAdded= value.Type();
159 strBuffer <<
" -> " << value.GetLinkTarget();
160 if( value.GetRealLinkTarget().IsNotEmpty()
161 && !value.GetLinkTarget().Equals( value.GetRealLinkTarget()) )
162 strBuffer <<
" (" << value.GetRealLinkTarget() <<
")";
163 toBeAdded= strBuffer;
171 case 'x' : toBeAdded= (value.IsCrossingFS() ?
'm' :
'-') ;
break;
172 case 'a' : toBeAdded= (value.IsArtificialFS() ?
'm' :
'-') ;
break;
176 "Format Error: Unknown character {} after token 'f' in File::Format.", c )
177 target <<
"Format Error: Unknown character '" << c <<
"' after token 'f' in File::Format.";
184 toBeAdded= value.QtyHardLinks();
189 else toBeAdded= value.Quality();
197 case 'm' : date= value.MDate();
break;
198 case 'b' : date= value.BDate();
break;
199 case 'c' : date= value.CDate();
break;
200 case 'a' : date= value.ADate();
break;
204 "Format Error: Unknown character {} after token 'd' in File::Format.", c )
205 target <<
"Format Error: Unknown character '" << c <<
"' after token 'd' in File::Format.";
212 dateFormat=
A_CHAR(
"dd. MMM yyyy HH:mm");
213 date.
Format( dateFormat, strBuffer );
214 toBeAdded= strBuffer;
220 bool automaticMode =
true;
221 auto unit = ByteSizeUnits::IEC;
229 unit= ByteSizeUnits::SI;
239 automaticMode=
false;
245 "Format Error: Expected closing brace ')' after unit specification with token 's'." )
246 target <<
"Format Error: Expected closing brace ')' after unit specification with token 's'.";
257 if( unit==ByteSizeUnits::B || unit ==ByteSizeUnits::B_SI )
267 toBeAdded= strBuffer;
274 bool isOwner= c==
'o';
277 if( c !=
'i' && c !=
'n' )
280 "Format Error: Expected 'i' or 'n' specifier after token 'o' and 'g'. Given: {}" )
281 target <<
"Format Error: Expected 'i' or 'n' specifier after token 'o' and 'g'. Given: '" << c <<
"'";
284 bool isName= (c ==
'n');
289 toBeAdded= isOwner ? resolver.GetOwnerName(value)
290 : resolver.GetGroupName(value);
294 strBuffer << (isOwner ? value.Owner() : value.Group());
295 toBeAdded= strBuffer;
305 if( !value.IsDirectory()
322 "Format Error: Token 'r' followed by unknown specifier {!Q'} in File::Format", c )
323 target <<
"Format Error: Token 'r' followed by unknown specifier '" << c <<
"'in File::Format";
349 ALIB_WARNING(
"ALIB",
"Format Error: Missing single Quote" )
350 target <<
"Format Error: Missing closing single quote character <'>" ;
354 target.
_<
NC>( format, 0, end );
355 format.ConsumeChars<
NC>( end + 1 );
378 "Format Error: Expected closing brace '}' with field specifier {width/alignment}." )
379 target <<
"Format Error: Expected closing brace '}' with field specifier {width/alignment}.";
389 target.
ToUpper(previousLength);
413void T_Append<files::File,nchar, lang::HeapAllocator>::operator()( TAString<nchar, lang::HeapAllocator>& target,
const files::File& file )
420void T_Append<files::File,wchar, lang::HeapAllocator>::operator()( TAString<wchar, lang::HeapAllocator>& target,
const files::File& file )
const TUnboxable Unbox() const
constexpr CharacterType Separator() const noexcept
@ GROUP_READ
< S_IRWXU File owner has read, write, and execute/search permissions Equivalent to owner_read | owner...
@ GROUP_EXEC
< S_IWGRP The file's user group has write permission
@ OTHERS_EXEC
S_IXOTH Other users have execute/search permission.
@ GROUP_WRITE
< S_IRGRP The file's user group has read permission
@ OWNER_EXEC
< S_IWUSR File owner has write permission
@ OWNER_WRITE
< S_IRUSR File owner has read permission
@ OTHERS_READ
< S_IRWXG The file's user group has read, write, and execute/search permissions Equivalent to group_r...
@ OTHERS_WRITE
S_IWOTH Other users have write permission.
@ RECURSIVE
Follow symlink target strings.
@ RESOLVED
Read symlink target strings.
OwnerAndGroupResolver & GetOGResolver()
NumberFormat & GetNumberFormat()
ALIB_WARNINGS_RESTORE lang::system::PathString Stem() const
AString & FormatAccessRights(AString &target) const
const NameType & Name() const
lang::system::PathString Extension() const
Path & AssemblePath(Path &target, lang::CurrentData targetData=lang::CurrentData::Clear) const
ALIB_API AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep, NumberFormat *numberFormat=nullptr) const
const String & GetResource(const NString &name)
ALIB_API AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep) const
TAString & ToUpper(integer regionStart=0, integer regionLength=MAX_LEN)
TAString & InsertChars(TChar c, integer qty)
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
integer IndexOf(TChar needle, integer startIdx=0) const
constexpr bool IsEmpty() const
constexpr bool IsNotEmpty() const
constexpr integer Length() const
TChar CharAtStart() const
bool StartsWith(const TString &needle) const
TString< TChar > ConsumeField(TChar startChar, TChar endChar)
integer ConsumeChars(integer regionLength, TSubstring *target=nullptr)
bool ConsumeInt(TIntegral &result, TNumberFormat< TChar > *numberFormat=nullptr)
#define ALIB_WARNING(...)
bool Parse(strings::TSubstring< TChar > &input, TEnum &result)
void FFormat_File(const alib::Box &box, const alib::String &formatSpec, alib::NumberFormat &nf, alib::AString &target)
This is the reference documentation of sub-namespace system of module ALib BaseCamp.
static constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
@ Keep
Chooses not no clear existing data.
@ Clear
Chooses to clear existing data.
Alignment
Denotes Alignments.
@ Right
Chooses right alignment.
lang::uinteger uinteger
Type alias in namespace alib.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
strings::TFormat< character > Format
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
Recursively accumulated values for directories.
uint32_t QtyErrsAccess
Number of access errors in the folder and subfolders.
uint32_t CountNonDirectories() const noexcept
uint32_t QtyErrsBrokenLink
Number of broken symbolic links in the directory and its subfolders.
uint32_t CountDirectories() const noexcept