Kodi Development  19.0
for Binary and Script based Add-Ons

Detailed Description

Virtual file server directory entry
This class is used as an entry for files and folders in kodi::vfs::GetDirectory().


Example:

#include <kodi/Filesystem.h>
...
std::vector<kodi::vfs::CDirEntry> items;
kodi::vfs::GetDirectory("special://temp", "", items);
fprintf(stderr, "Directory have %lu entries\n", items.size());
for (unsigned long i = 0; i < items.size(); i++)
{
char buff[20];
time_t now = items[i].DateTime();
strftime(buff, 20, "%Y-%m-%d %H:%M:%S", gmtime(&now));
fprintf(stderr, " - %04lu -- Folder: %s -- Name: %s -- Path: %s -- Time: %s\n",
i+1,
items[i].IsFolder() ? "yes" : "no ",
items[i].Label().c_str(),
items[i].Path().c_str(),
buff);
}

It has the header #include <kodi/Filesystem.h> be included to enjoy it.

The following table contains values that can be set with class CDirEntry :

Name Type Set call Get call Clear call
Directory entry name std::string SetLabel Label
Title of entry std::string SetTitle Title
Path of the entry std::string SetPath Path
Entry is folder bool SetFolder IsFolder
The size of the file int64_t SetSize Size
File time and date time_t SetDateTime DateTime
Property entries std::string, std::string AddProperty GetProperties ClearProperties

Modules

 <em>Value Help</em>
 

Function Documentation

◆ CDirEntry()

CDirEntry ( const std::string &  label = "",
const std::string &  path = "",
bool  folder = false,
int64_t  size = -1,
time_t  dateTime = 0 
)
inline

Constructor for VFS directory entry.

Parameters
[in]label[opt] Name to use for entry
[in]path[opt] Used path of the entry
[in]folder[opt] If set entry used as folder
[in]size[opt] If used as file, his size defined there
[in]dateTime[opt] Date time of the entry
kodi::vfs::CDirEntry::Label
const std::string & Label(void) const
Get the directory entry name.
Definition: Filesystem.h:608
kodi::vfs::CDirEntry::DateTime
time_t DateTime()
Get file time and date for a new entry.
Definition: Filesystem.h:648
kodi::vfs::CDirEntry::Path
const std::string & Path(void) const
Get the path of the entry.
Definition: Filesystem.h:624
kodi::vfs::CDirEntry
Definition: Filesystem.h:542
kodi::vfs::GetDirectory
bool ATTRIBUTE_HIDDEN GetDirectory(const std::string &path, const std::string &mask, std::vector< kodi::vfs::CDirEntry > &items)
Lists a directory.
Definition: Filesystem.h:887
kodi::vfs::CDirEntry::IsFolder
bool IsFolder(void) const
Used to check entry is folder.
Definition: Filesystem.h:632