1
1
#include " nbl/system/ISystemPOSIX.h"
2
2
#include " nbl/system/CFilePOSIX.h"
3
3
4
+ #include " nbl/system/IFile.h"
5
+
4
6
using namespace nbl ;
5
7
using namespace nbl ::system;
6
8
7
- #if defined(__unix__)
9
+ #if defined(_NBL_PLATFORM_LINUX_) || defined (_NBL_PLATFORM_ANDROID_)
10
+
8
11
#include < fcntl.h>
9
12
#include < sys/mman.h>
10
13
#include < sys/stat.h>
@@ -13,7 +16,7 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
13
16
{
14
17
const bool writeAccess = flags.value &IFile::ECF_WRITE;
15
18
int createFlags = O_LARGEFILE|(writeAccess ? O_CREAT:0 );
16
- switch (_flags .value &IFile::ECF_READ_WRITE) )
19
+ switch (flags .value &IFile::ECF_READ_WRITE)
17
20
{
18
21
case IFile::ECF_READ:
19
22
createFlags |= O_RDONLY;
@@ -30,7 +33,7 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
30
33
}
31
34
32
35
CFilePOSIX::native_file_handle_t _native = -1 ;
33
- auto filenameStream = _filename .string ();
36
+ auto filenameStream = filename .string ();
34
37
const char * name_c_str = filenameStream.c_str ();
35
38
// only create a new file if we're going to be writing
36
39
if (writeAccess)
@@ -60,7 +63,7 @@ core::smart_refctd_ptr<ISystemFile> ISystemPOSIX::CCaller::createFile(const std:
60
63
61
64
// map if needed
62
65
void * _mappedPtr = nullptr ;
63
- if (_flags .value & ECF_MAPPABLE)
66
+ if (flags .value & IFile:: ECF_MAPPABLE)
64
67
{
65
68
const int mappingFlags = ((flags.value &IFile::ECF_READ) ? PROT_READ:0 )|(writeAccess ? PROT_WRITE:0 );
66
69
_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:
71
74
}
72
75
}
73
76
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);
75
78
}
76
79
#endif
0 commit comments