Changeset 425 for cpp/common
- Timestamp:
- 08/27/15 00:05:32 (9 years ago)
- Location:
- cpp/common/virtfile
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/virtfile/stdiofile.cpp
r375 r425 8 8 #include <common/log.h> 9 9 #include <common/Convert.h> 10 #ifdef __ANDROID__ 11 #include <common/dirs.h> 12 #include <common/platform/android/AndroidAPK_DIR.h> 13 #endif 10 14 11 15 VirtFILE* StdioFileSystem::Vfopen(const char *path, const char *mode) … … 24 28 { 25 29 //log_printf("Vopendir %s",path); 30 #ifdef __ANDROID__ 31 int resources_prefix_length=getAppResourcesDir().length(); 32 if (strncmp(path, getAppResourcesDir().c_str(), resources_prefix_length) == 0) //it is a resources dir 33 { 34 VirtDIR *vd = AndroidAPK_DIR::opendir(path+resources_prefix_length+1); //+1 because we also skip '/' and start with a "relative" dir, otherwise it does not work. 35 return vd; 36 } 37 #endif 38 26 39 #ifdef _WIN32 27 40 DIRTYPE *d = wopendir(Convert::utf8ToUtf16(path).c_str()); … … 38 51 } 39 52 53 #ifndef NO_STD_IN_OUT_ERR 40 54 void StdioFILE::setStdio() 41 55 { 42 #ifndef NO_STD_IN_OUT_ERR43 56 static StdioFILEDontClose si(stdin); 44 57 static StdioFILEDontClose so(stdout); … … 47 60 setVstdout(&so); 48 61 setVstderr(&se); 62 } 49 63 #endif 50 }51 64 52 65 dirent* StdioDIR::Vreaddir() -
cpp/common/virtfile/stdiofile.h
r299 r425 28 28 StdioFILE(MFILE *f):VirtFILE("") { file = f; } 29 29 StdioFILE(MFILE *f, const char* p):VirtFILE(p) { file = f; } 30 #ifndef NO_STD_IN_OUT_ERR 30 31 static void setStdio(); 32 #endif 31 33 size_t Vread(void *ptr, size_t size, size_t nmemb) { return mfread(ptr, size, nmemb, file); } 32 34 size_t Vwrite(const void *ptr, size_t size, size_t nmemb) { return mfwrite(ptr, size, nmemb, file); } … … 48 50 StdioFILE(FILE *f):VirtFILE("") { file = f; } 49 51 StdioFILE(FILE *f, const char* p):VirtFILE(p) { file = f; } 52 #ifndef NO_STD_IN_OUT_ERR 50 53 static void setStdio(); 54 #endif 51 55 size_t Vread(void *ptr, size_t size, size_t nmemb) { return fread(ptr, size, nmemb, file); } 52 56 size_t Vwrite(const void *ptr, size_t size, size_t nmemb) { return fwrite(ptr, size, nmemb, file); }
Note: See TracChangeset
for help on using the changeset viewer.