11#include " nbl/system/ISystemPOSIX.h"
22#include " nbl/system/CFilePOSIX.h"
33
4+ #include " nbl/system/IFile.h"
5+
46using namespace nbl ;
57using namespace nbl ::system;
68
7- #if defined(__unix__)
9+ #if defined(_NBL_PLATFORM_LINUX_) || defined (_NBL_PLATFORM_ANDROID_)
10+
811#include < fcntl.h>
912#include < sys/mman.h>
1013#include < sys/stat.h>
@@ -13,7 +16,7 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
1316{
1417 const bool writeAccess = flags.value &IFile::ECF_WRITE;
1518 int createFlags = O_LARGEFILE|(writeAccess ? O_CREAT:0 );
16- switch (_flags .value &IFile::ECF_READ_WRITE) )
19+ switch (flags .value &IFile::ECF_READ_WRITE)
1720 {
1821 case IFile::ECF_READ:
1922 createFlags |= O_RDONLY;
@@ -30,7 +33,7 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
3033 }
3134
3235 CFilePOSIX::native_file_handle_t _native = -1 ;
33- auto filenameStream = _filename .string ();
36+ auto filenameStream = filename .string ();
3437 const char * name_c_str = filenameStream.c_str ();
3538 // only create a new file if we're going to be writing
3639 if (writeAccess)
@@ -60,7 +63,7 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
6063
6164 // map if needed
6265 void * _mappedPtr = nullptr ;
63- if (_flags .value & ECF_MAPPABLE)
66+ if (flags .value & IFile:: ECF_MAPPABLE)
6467 {
6568 const int mappingFlags = ((flags.value &IFile::ECF_READ) ? PROT_READ:0 )|(writeAccess ? PROT_WRITE:0 );
6669 _mappedPtr = mmap ((caddr_t )0 , _size, mappingFlags, MAP_PRIVATE, _native, 0 );
@@ -71,6 +74,6 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
7174 }
7275 }
7376
74- return core::make_smart_refctd_ptr<CFilePOSIX>(core::smart_refctd_ptr<ISystem>(m_system),filename,flags,_mappedPtr,_size,_native);
77+ return core::make_smart_refctd_ptr<CFilePOSIX>(core::smart_refctd_ptr<ISystem>(m_system),path ( filename) ,flags,_mappedPtr,_size,_native);
7578}
7679#endif
0 commit comments