Nebula
Loading...
Searching...
No Matches
Posix::PosixFSWrapper Class Reference

#include <posixfswrapper.h>

Detailed Description

Internal filesystem wrapper for Posix.

All paths must be native Posix paths.

(C) 2006 Radon Labs GmbH (C) 2013-2018 Individual contributors, see AUTHORS file

Public Types

typedef FILE * Handle
 

Static Public Member Functions

static Handle OpenFile (const Util::String &path, IO::Stream::AccessMode accessMode, IO::Stream::AccessPattern accessPattern)
 open a file
 
static void CloseFile (Handle h)
 close a file
 
static void Write (Handle h, const void *buf, IO::Stream::Size numBytes)
 write to a file
 
static IO::Stream::Size Read (Handle h, void *buf, IO::Stream::Size numBytes)
 read from a file
 
static char * Map (Handle h, IO::Stream::AccessMode accessMode, Handle &mappedHandle)
 map file to virtual memory
 
static void Unmap (Handle mapHandle, char *buf)
 unmap file
 
static void Seek (Handle h, IO::Stream::Offset offset, IO::Stream::SeekOrigin orig)
 seek in a file
 
static IO::Stream::Position Tell (Handle h)
 get position in file
 
static void Flush (Handle h)
 flush a file
 
static bool Eof (Handle h)
 return true if at end-of-file
 
static IO::Stream::Size GetFileSize (Handle h)
 get size of a file in bytes
 
static void SetReadOnly (const Util::String &path, bool readOnly)
 set read-only status of a file
 
static bool IsReadOnly (const Util::String &path)
 get read-only status of a file
 
static bool IsLocked (const Util::String &path)
 get locked status of file
 
static bool DeleteFile (const Util::String &path)
 delete a file
 
static bool ReplaceFile (const Util::String &source, const Util::String &target)
 rename a file
 
static bool DeleteDirectory (const Util::String &path)
 delete an empty directory
 
static bool FileExists (const Util::String &path)
 return true if a file exists
 
static bool DirectoryExists (const Util::String &path)
 return true if a directory exists
 
static void SetFileWriteTime (const Util::String &path, IO::FileTime fileTime)
 set the write-access time stamp of a file
 
static IO::FileTime GetFileWriteTime (const Util::String &path)
 get the last write-access time stamp of a file
 
static bool CreateDirectory (const Util::String &path)
 create a directory
 
static Util::String CreateTemporaryFilename (const Util::String &path)
 create a temporary file name
 
static Util::Array< Util::StringListFiles (const Util::String &dirPath, const Util::String &pattern)
 list all files in a directory
 
static Util::Array< Util::StringListDirectories (const Util::String &dirPath, const Util::String &pattern)
 list all subdirectories in a directory
 
static Util::String GetUserDirectory ()
 get path to the current user's home directory (for user: standard assign)
 
static Util::String GetTempDirectory ()
 get path to the current user's temp directory (for temp: standard assign)
 
static Util::String GetHomeDirectory ()
 get path to the current application directory (for home: standard assign)
 
static Util::String GetBinDirectory ()
 get path to the current bin directory (for bin: standard assign)
 
static bool IsDeviceName (const Util::String &str)
 return true when the string is a device name (e.g. "C:")
 

Member Typedef Documentation

◆ Handle

Member Function Documentation

◆ CloseFile()

void Posix::PosixFSWrapper::CloseFile ( Handle h)
static

close a file

Closes a file opened by PosixFSWrapper::OpenFile().

◆ CreateDirectory()

bool Posix::PosixFSWrapper::CreateDirectory ( const Util::String & path)
static

create a directory

Creates a new directory.

◆ CreateTemporaryFilename()

Util::String Posix::PosixFSWrapper::CreateTemporaryFilename ( const Util::String & path)
static

create a temporary file name

◆ DeleteDirectory()

bool Posix::PosixFSWrapper::DeleteDirectory ( const Util::String & path)
static

delete an empty directory

Delete an empty directory.

Returns true if the operation was successful.

◆ DeleteFile()

bool Posix::PosixFSWrapper::DeleteFile ( const Util::String & path)
static

delete a file

Deletes a file.

Returns true if the operation was successful. The delete will fail if the fail doesn't exist or the file is read-only.

◆ DirectoryExists()

bool Posix::PosixFSWrapper::DirectoryExists ( const Util::String & path)
static

return true if a directory exists

Return true if a directory exists.

◆ Eof()

bool Posix::PosixFSWrapper::Eof ( Handle h)
static

return true if at end-of-file

Returns true if current position is at end of file.

◆ FileExists()

bool Posix::PosixFSWrapper::FileExists ( const Util::String & path)
static

return true if a file exists

Return true if a file exists.

◆ Flush()

void Posix::PosixFSWrapper::Flush ( Handle h)
static

flush a file

Flush unwritten data to file.

◆ GetBinDirectory()

String Posix::PosixFSWrapper::GetBinDirectory ( )
static

get path to the current bin directory (for bin: standard assign)

This method sould return the directory where the application executable is located.

◆ GetFileSize()

Stream::Size Posix::PosixFSWrapper::GetFileSize ( Handle h)
static

get size of a file in bytes

Returns the size of a file in bytes.

◆ GetFileWriteTime()

FileTime Posix::PosixFSWrapper::GetFileWriteTime ( const Util::String & path)
static

get the last write-access time stamp of a file

Return the last write-access time to a file.

◆ GetHomeDirectory()

String Posix::PosixFSWrapper::GetHomeDirectory ( )
static

get path to the current application directory (for home: standard assign)

This method should return the installation directory of the application.

Under Nebula, this is either the directory where the executable is located, or 2 levels above the executable (if it is in home:bin/posix).

◆ GetTempDirectory()

String Posix::PosixFSWrapper::GetTempDirectory ( )
static

get path to the current user's temp directory (for temp: standard assign)

This method should return a directory for temporary files with read/write access for the current user.

◆ GetUserDirectory()

String Posix::PosixFSWrapper::GetUserDirectory ( )
static

get path to the current user's home directory (for user: standard assign)

This method should return the path to the current user's home directory.

This is the directory where application can write their data to. Under windows, this is the "My Files" directory.

◆ IsDeviceName()

bool Posix::PosixFSWrapper::IsDeviceName ( const Util::String & str)
static

return true when the string is a device name (e.g. "C:")

◆ IsLocked()

bool Posix::PosixFSWrapper::IsLocked ( const Util::String & path)
static

get locked status of file

try to check for a lock by trying to lock the file.

inherently racey, but good enough in some situations

◆ IsReadOnly()

bool Posix::PosixFSWrapper::IsReadOnly ( const Util::String & path)
static

get read-only status of a file

Get the read-only status of a file.

◆ ListDirectories()

Array< String > Posix::PosixFSWrapper::ListDirectories ( const Util::String & dirPath,
const Util::String & pattern )
static

list all subdirectories in a directory

Lists all subdirectories in a directory, filtered by a pattern.

This will not return the special directories ".." and ".".

◆ ListFiles()

Array< String > Posix::PosixFSWrapper::ListFiles ( const Util::String & dirPath,
const Util::String & pattern )
static

list all files in a directory

Lists all files in a directory, filtered by a pattern.

◆ Map()

char * Posix::PosixFSWrapper::Map ( Handle h,
IO::Stream::AccessMode accessMode,
Handle & mappedHandle )
static

map file to virtual memory

◆ OpenFile()

PosixFSWrapper::Handle Posix::PosixFSWrapper::OpenFile ( const Util::String & path,
IO::Stream::AccessMode accessMode,
IO::Stream::AccessPattern accessPattern )
static

open a file

Open a file using the Posix function CreateFile().

Returns a handle to the file which must be passed to the other PosixFSWrapper file methods. If opening the file fails, the function will return 0. The filename must be a native Posix path (no assigns, etc...).

◆ Read()

Stream::Size Posix::PosixFSWrapper::Read ( Handle h,
void * buf,
IO::Stream::Size numBytes )
static

read from a file

Read data from a file, returns number of bytes read.

◆ ReplaceFile()

bool Posix::PosixFSWrapper::ReplaceFile ( const Util::String & source,
const Util::String & target )
static

rename a file

◆ Seek()

void Posix::PosixFSWrapper::Seek ( Handle h,
IO::Stream::Offset offset,
IO::Stream::SeekOrigin orig )
static

seek in a file

Seek in a file.

◆ SetFileWriteTime()

void Posix::PosixFSWrapper::SetFileWriteTime ( const Util::String & path,
IO::FileTime fileTime )
static

set the write-access time stamp of a file

◆ SetReadOnly()

void Posix::PosixFSWrapper::SetReadOnly ( const Util::String & path,
bool readOnly )
static

set read-only status of a file

Set the read-only status of a file.

◆ Tell()

Stream::Position Posix::PosixFSWrapper::Tell ( Handle h)
static

get position in file

Get current position in file.

◆ Unmap()

void Posix::PosixFSWrapper::Unmap ( Handle mapHandle,
char * buf )
static

unmap file

◆ Write()

void Posix::PosixFSWrapper::Write ( Handle h,
const void * buf,
IO::Stream::Size numBytes )
static

write to a file

Write data to a file.


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