Nebula
Loading...
Searching...
No Matches
osxfswrapper.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
11#include "core/types.h"
12#include "util/string.h"
13#include "util/array.h"
14#include "io/stream.h"
15#include "io/filetime.h"
16
17//------------------------------------------------------------------------------
18namespace OSX
19{
21{
22public:
23 typedef FILE* Handle;
24
26 static Handle OpenFile(const Util::String& path, IO::Stream::AccessMode accessMode, IO::Stream::AccessPattern accessPattern);
28 static void CloseFile(Handle h);
30 static void Write(Handle h, const void* buf, IO::Stream::Size numBytes);
32 static IO::Stream::Size Read(Handle h, void* buf, IO::Stream::Size numBytes);
34 static void Seek(Handle h, IO::Stream::Offset offset, IO::Stream::SeekOrigin orig);
38 static void Flush(Handle h);
40 static bool Eof(Handle h);
44 static void SetReadOnly(const Util::String& path, bool readOnly);
46 static bool IsReadOnly(const Util::String& path);
48 static bool DeleteFile(const Util::String& path);
50 static bool DeleteDirectory(const Util::String& path);
52 static bool FileExists(const Util::String& path);
54 static bool DirectoryExists(const Util::String& path);
56 static void SetFileWriteTime(const Util::String& path, IO::FileTime fileTime);
58 static IO::FileTime GetFileWriteTime(const Util::String& path);
60 static bool CreateDirectory(const Util::String& path);
62 static Util::Array<Util::String> ListFiles(const Util::String& dirPath, const Util::String& pattern);
64 static Util::Array<Util::String> ListDirectories(const Util::String& dirPath, const Util::String& pattern);
78 static bool IsDeviceName(const Util::String& str);
80 static const char* ConvertPath(const Util::String& str);
81};
82
83}; // namespace OSX
84//------------------------------------------------------------------------------
Defines a file-access timestamp.
SeekOrigin
seek origins
Definition stream.h:54
int64_t Offset
Definition stream.h:33
int64_t Position
typedefs
Definition stream.h:32
int64_t Size
Definition stream.h:34
AccessMode
access modes
Definition stream.h:38
AccessPattern
access prefered pattern
Definition stream.h:47
Internal filesystem wrapper for the OSX.
Definition osxfswrapper.h:21
static Util::String GetHomeDirectory()
get path to the current application directory (for home: standard assign)
Definition osxfswrapper.cc:264
static bool DeleteDirectory(const Util::String &path)
delete an empty directory
Definition osxfswrapper.cc:135
static IO::Stream::Size GetFileSize(Handle h)
get size of a file in bytes
Definition osxfswrapper.cc:96
FILE * Handle
Definition osxfswrapper.h:23
static Util::String GetTempDirectory()
get path to the current user's temp directory (for temp: standard assign)
Definition osxfswrapper.cc:244
static Util::String GetBinDirectory()
get path to the current bin directory (for bin: standard assign)
Definition osxfswrapper.cc:254
static void Seek(Handle h, IO::Stream::Offset offset, IO::Stream::SeekOrigin orig)
seek in a file
Definition osxfswrapper.cc:58
static Util::Array< Util::String > ListDirectories(const Util::String &dirPath, const Util::String &pattern)
list all subdirectories in a directory
Definition osxfswrapper.cc:204
static bool CreateDirectory(const Util::String &path)
create a directory
Definition osxfswrapper.cc:184
static bool DeleteFile(const Util::String &path)
delete a file
Definition osxfswrapper.cc:125
static IO::FileTime GetFileWriteTime(const Util::String &path)
get the last write-access time stamp of a file
Definition osxfswrapper.cc:174
static Util::String GetUserDirectory()
get path to the current user's home directory (for user: standard assign)
Definition osxfswrapper.cc:214
static void SetReadOnly(const Util::String &path, bool readOnly)
set read-only status of a file
Definition osxfswrapper.cc:106
static bool DirectoryExists(const Util::String &path)
return true if a directory exists
Definition osxfswrapper.cc:155
static bool IsReadOnly(const Util::String &path)
get read-only status of a file
Definition osxfswrapper.cc:115
static IO::Stream::Size Read(Handle h, void *buf, IO::Stream::Size numBytes)
read from a file
Definition osxfswrapper.cc:48
static Util::String GetProgramsDirectory()
get path to the "c:/program files" directory
Definition osxfswrapper.cc:234
static void SetFileWriteTime(const Util::String &path, IO::FileTime fileTime)
set the write-access time stamp of a file
Definition osxfswrapper.cc:165
static bool FileExists(const Util::String &path)
return true if a file exists
Definition osxfswrapper.cc:145
static bool IsDeviceName(const Util::String &str)
return true when the string is a device name (e.g. "C:")
Definition osxfswrapper.cc:274
static const char * ConvertPath(const Util::String &str)
skips the OSX: at the start of the path
Definition osxfswrapper.cc:284
static void CloseFile(Handle h)
close a file
Definition osxfswrapper.cc:30
static Util::String GetAppDataDirectory()
get path to the current user's appdata directory (for appdata: standard assign)
Definition osxfswrapper.cc:224
static Handle OpenFile(const Util::String &path, IO::Stream::AccessMode accessMode, IO::Stream::AccessPattern accessPattern)
open a file
Definition osxfswrapper.cc:20
static Util::Array< Util::String > ListFiles(const Util::String &dirPath, const Util::String &pattern)
list all files in a directory
Definition osxfswrapper.cc:194
static bool Eof(Handle h)
return true if at end-of-file
Definition osxfswrapper.cc:86
static void Flush(Handle h)
flush a file
Definition osxfswrapper.cc:77
static IO::Stream::Position Tell(Handle h)
get position in file
Definition osxfswrapper.cc:67
Nebula's dynamic array class.
Definition array.h:60
@ Write
Definition filewatcher.h:47
Definition osxsysfunc.h:21
Nebula's universal string class.
Definition string.h:50