Ultralight  1.0.0
A fast, lightweight, HTML UI engine for native apps.
ultralight::FileSystem Class Referenceabstract

FileSystem interface, used for all file system operations. More...

#include <FileSystem.h>

Public Member Functions

virtual bool FileExists (const String16 &path)=0
 Check if file path exists, return true if exists.
 
virtual bool DeleteFile_ (const String16 &path)=0
 Delete file, return true on success.
 
virtual bool DeleteEmptyDirectory (const String16 &path)=0
 Delete empty directory, return true on success.
 
virtual bool MoveFile_ (const String16 &old_path, const String16 &new_path)=0
 Move file, return true on success.
 
virtual bool GetFileSize (const String16 &path, int64_t &result)=0
 Get file size, store result in 'result'. More...
 
virtual bool GetFileSize (FileHandle handle, int64_t &result)=0
 Get file size of previously opened file, store result in 'result'. More...
 
virtual bool GetFileMimeType (const String16 &path, String16 &result)=0
 Get file mime type (eg "text/html"), store result in 'result'. More...
 
virtual bool GetFileModificationTime (const String16 &path, time_t &result)=0
 Get file last modification time, store result in 'result'. More...
 
virtual bool GetFileCreationTime (const String16 &path, time_t &result)=0
 Get file creation time, store result in 'result'. More...
 
virtual MetadataType GetMetadataType (const String16 &path)=0
 Get path type (file or directory).
 
virtual String16 GetPathByAppendingComponent (const String16 &path, const String16 &component)=0
 Concatenate path with another path component. More...
 
virtual bool CreateDirectory_ (const String16 &path)=0
 Create directory, return true on success.
 
virtual String16 GetHomeDirectory ()=0
 Get home directory path.
 
virtual String16 GetFilenameFromPath (const String16 &path)=0
 Get filename component from path.
 
virtual String16 GetDirectoryNameFromPath (const String16 &path)=0
 Get directory name from path.
 
virtual bool GetVolumeFreeSpace (const String16 &path, uint64_t &result)=0
 Get volume from path and store free space in 'result'. More...
 
virtual int32_t GetVolumeId (const String16 &path)=0
 Get volume from path and return its unique volume id.
 
virtual Ref< String16VectorListDirectory (const String16 &path, const String16 &filter)=0
 Get file listing for directory path with optional filter, return vector of file paths.
 
virtual String16 OpenTemporaryFile (const String16 &prefix, FileHandle &handle)=0
 Open a temporary file with suggested prefix, store handle in 'handle'. More...
 
virtual FileHandle OpenFile (const String16 &path, bool open_for_writing)=0
 Open file path for reading or writing. More...
 
virtual void CloseFile (FileHandle &handle)=0
 Close previously-opened file.
 
virtual int64_t SeekFile (FileHandle handle, int64_t offset, FileSeekOrigin origin)=0
 Seek currently-opened file, with offset relative to certain origin. More...
 
virtual bool TruncateFile (FileHandle handle, int64_t offset)=0
 Truncate currently-opened file with offset, return true on success.
 
virtual int64_t WriteToFile (FileHandle handle, const char *data, int64_t length)=0
 Write to currently-opened file, return number of bytes written or -1 on failure.
 
virtual int64_t ReadFromFile (FileHandle handle, char *data, int64_t length)=0
 Read from currently-opened file, return number of bytes read or -1 on failure.
 
virtual bool CopyFile_ (const String16 &source_path, const String16 &destination_path)=0
 Copy file from source to destination, return true on success.
 

Detailed Description

FileSystem interface, used for all file system operations.

This is used for things like loading File URLs (eg, file:///page.html and the JavaScript FileSystem API. If you don't implement this interface, you will not be able to load any File URLs.

This is intended to be implemented by users and defined before creating the Renderer.

See also
Platform::set_file_system.
Note
To support File URL loading, you ONLY need to implement the following functions:

Definition at line 73 of file FileSystem.h.

Member Function Documentation

◆ GetFileCreationTime()

virtual bool ultralight::FileSystem::GetFileCreationTime ( const String16 path,
time_t &  result 
)
pure virtual

Get file creation time, store result in 'result'.

Return true on success.

◆ GetFileMimeType()

virtual bool ultralight::FileSystem::GetFileMimeType ( const String16 path,
String16 result 
)
pure virtual

Get file mime type (eg "text/html"), store result in 'result'.

Return true on success.

◆ GetFileModificationTime()

virtual bool ultralight::FileSystem::GetFileModificationTime ( const String16 path,
time_t &  result 
)
pure virtual

Get file last modification time, store result in 'result'.

Return true on success.

◆ GetFileSize() [1/2]

virtual bool ultralight::FileSystem::GetFileSize ( const String16 path,
int64_t &  result 
)
pure virtual

Get file size, store result in 'result'.

Return true on success.

◆ GetFileSize() [2/2]

virtual bool ultralight::FileSystem::GetFileSize ( FileHandle  handle,
int64_t &  result 
)
pure virtual

Get file size of previously opened file, store result in 'result'.

Return true on success.

◆ GetPathByAppendingComponent()

virtual String16 ultralight::FileSystem::GetPathByAppendingComponent ( const String16 path,
const String16 component 
)
pure virtual

Concatenate path with another path component.

Return concatenated result.

◆ GetVolumeFreeSpace()

virtual bool ultralight::FileSystem::GetVolumeFreeSpace ( const String16 path,
uint64_t &  result 
)
pure virtual

Get volume from path and store free space in 'result'.

Return true on success.

◆ OpenFile()

virtual FileHandle ultralight::FileSystem::OpenFile ( const String16 path,
bool  open_for_writing 
)
pure virtual

Open file path for reading or writing.

Return file handle on success, or invalidFileHandle on failure.

◆ OpenTemporaryFile()

virtual String16 ultralight::FileSystem::OpenTemporaryFile ( const String16 prefix,
FileHandle handle 
)
pure virtual

Open a temporary file with suggested prefix, store handle in 'handle'.

Return path of temporary file.

◆ SeekFile()

virtual int64_t ultralight::FileSystem::SeekFile ( FileHandle  handle,
int64_t  offset,
FileSeekOrigin  origin 
)
pure virtual

Seek currently-opened file, with offset relative to certain origin.

Return new file offset.


The documentation for this class was generated from the following file: