14# if !defined(HPP_ALIB_LANG_FORMAT_FORMATTER)
19#if !defined ( _WIN32 )
45 "CAMP/FILES",
"Given node is not a directory.")
66 "CAMP/FILES",
"Given node is not a directory or symbolic link.")
70 "CAMP/FILES",
"Error in symbolic link parameter" )
73 auto& v = node.
Value();
87 v.SetExtendedInfo(&recycled->data);
102 v.SetExtendedInfo(&recycled->data);
106 v.SetLinkTarget(symLinkDest, symLinkRealPath);
117 v.SetExtendedInfo(&recycled->data);
121 v.SetLinkTarget(symLinkDest, symLinkRealPath);
166 ALIB_ERROR(
"CAMP/FILES",
"No extended information for type {!Q}", type )
175#if ALIB_DEBUG && !defined(ALIB_DOX)
177void dbgDumpEntry(
AString& buf ,
180 const int* nameWidth,
185 auto& entry= node.
Value();
186 std::pair<String,String> ownerAndGroup= ogResolver.
Get( entry );
188 auto type= entry.Type();
193 fmt->Format( bufSize,
"{:5}" , size );
197 for(
const char* entity : {
"K",
"M",
"G",
"T" ,
"P",
"E" } )
201 fmt->Format( bufSize,
"{:5.1}{}",
double(size) / double(ks), entity );
209 auto quality= entry.Quality();
216 FInfo::DirectorySums& dirInfo= entry.Sums();
217 fmt->Format( bufSizes,
"({}d, {}f, {}ea, {}bl)",
218 dirInfo.CountDirectories(),
219 dirInfo.CountNonDirectories(),
220 dirInfo.QtyErrsAccess,
221 dirInfo.QtyErrsBrokenLink );
228 : scanResultText=
A_CHAR(
"OK ");
break;
253 symlinkInfo <<
" -> " << entry.GetLinkTarget();
254 if( entry.GetRealLinkTarget().IsNotEmpty()
255 && !entry.GetLinkTarget().Equals( entry.GetRealLinkTarget()) )
256 symlinkInfo <<
" (" << entry.GetRealLinkTarget() <<
")";
258 symlinkInfo <<
" (Broken)";
262 fmt->Format( buf,
"{} {:>4} {:>4} {:>6} {:yyyy-MM-dd HH:mm} {} {}{}",
263 entry.WriteTypeAndAccess( bufPerms.
Reset() ),
264 ownerAndGroup.first, ownerAndGroup.second,
268 entry.IsCrossingFS() ?
'M' :
'-',
269 entry.IsArtificialFS() ?
'A' :
'-' );
279 nodeStack[0]= actNode;
280 while( actNode.GoToParent().IsValid() )
281 nodeStack[sp++]= actNode;
285 for (
int i = sp-1; i >= 0; --i)
287 const String& name= nodeStack[i].Name();
288 fmt->Format( buf,
"{}{}{!FillC }",
289 i > sp-3 ?
"" : DirSep,
290 name.IsEmpty() ? DirSep : name,
291 i>0 ? nameWidth[sp-i-1] - name.Length() : 0);
299 fmt->Format( buf,
"{} {}\n", symlinkInfo, bufSizes );
307 EnumBitSet<FInfo::Types> includedTypes,
312 if( startNode.IsInvalid() )
313 startNode= tree.Root();
322 for (
int i = 0; i < 256; ++i) nameWidth[i]=0;
323 rit.Initialize( startNode );
324 while( rit.IsValid())
326 if( includedTypes.Test(rit.Node().Value().Type()))
327 nameWidth[rit.CurrentDepth()+1]= (std::max)( nameWidth[rit.CurrentDepth()+1],
328 int(rit.Node().Name().Length()) );
335 dbgDumpEntry( target, ogResolver, fmt, nameWidth, startNode );
336 rit.Initialize( startNode, depth );
337 while( rit.IsValid())
339 if( includedTypes.Test(rit.Node().Value().Type()))
340 dbgDumpEntry( target, ogResolver, fmt, nameWidth, rit.Node() );
@ DIRECTORY
Directory/folder.
constexpr DirectorySums & Sums() const
constexpr bool IsDirectory() const noexcept
@ NONE
no permission bits are set
constexpr Types Type() const noexcept
@ RECURSIVE
Follow symlink target strings.
@ STATS
Only stats (size, time, owner, etc.) read.
@ NO_ACCESS_DIR
Scanner failure due to limited access rights.
@ MAX_DEPTH_REACHED
Scanner stopped, because maximum depth was reached.
@ NOT_CROSSING_FS
A directory that represented a mounted filesystem was not followed due to field.
@ RESOLVED
Read symlink target strings.
@ NO_ACCESS_SL
Scanner failure due to limited access rights.
@ UNKNOWN_ERROR
Unknown scanner failure.
@ BROKEN_LINK
A symbolic link targets a non-existent file or directory.
@ NO_ACCESS_SL_TARGET
Scanner failure due to limited access rights.
@ NOT_FOLLOWED
A symbolic link that targets a directory, but scan parameters specify not to follow.
@ NO_ACCESS
Scanner failure due to limited access rights.
@ NOT_EXISTENT
Set if a given start path does not exist.
ALIB_API void AllocateExtendedInfo(Cursor &node, String &symLinkDest, String &symLinkRealPath)
static ALIB_API void FixSums(Cursor directoryNode)
LinkedEISLDir * recyclerEISlDir
Linked list hook for recycling information elements of disposed nodes.
LinkedEIDir * recyclerEIDir
Linked list hook for recycling information elements of disposed nodes.
ALIB_API integer CountRecyclables(FInfo::Types type)
LinkedEISL * recyclerEISL
Linked list hook for recycling information elements of disposed nodes.
ALIB_API FTree(monomem::MonoAllocator *allocator)
ALIB_API std::pair< String, String > Get(const FInfo &finfo)
MonoAllocator * GetAllocator()
void ConstructRootValue(TArgs &&... args)
TRecursiveIterator< false > RecursiveIterator
constexpr bool IsEmpty() const
#define ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH
#define ALIB_ASSERT_ERROR(cond,...)
#define Log_SetDomain(...)
#define ALIB_CALLER_PRUNED
ALIB_API AString & DbgDump(AString &target, FTree &tree, EnumBitSet< FInfo::Types > includedTypes=EnumBitSet< FInfo::Types >(true), FTree::Cursor startNode=FTree::Cursor(), unsigned int depth=(std::numeric_limits< unsigned int >::max)())
@ Off
Switch it off, switched off, etc.
files::OwnerAndGroupResolver OwnerAndGroupResolver
Type alias in namespace alib.
lang::uinteger uinteger
Type alias in namespace alib.
constexpr nchar DirectorySeparator
LocalString< 8 > String8
Type alias name for TLocalString<character,8> .
LocalString< 4096 > String4K
Type alias name for TLocalString<character,4096> .
std::shared_ptr< lang::format::Formatter > SPFormatter
strings::TAString< character > AString
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
files::FTree FTree
Type alias in namespace alib.
LocalString< 128 > String128
Type alias name for TLocalString<character,128> .
lang::integer integer
Type alias in namespace alib.
uint32_t TypeCounters[int(Types::MARKER_TYPES_END)]
Per-type counters.
FInfo::EIDirectory data
The usable data receivable with the FInfo instance.
LinkedEIDir * next
A recursive link to implement a recyling list.
LinkedEISLDir * next
A recursive link to implement a recyling list.
FInfo::EISymLinkDir data
The usable data receivable with the FInfo instance.
FInfo::EISymLinkFile data
The usable data receivable with the FInfo instance.
LinkedEISL * next
A recursive link to implement a recyling list.