// This file is a part of the Framsticks GDK. // Copyright (C) 1999-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. // Refer to http://www.framsticks.com/ for further information. #include "stdiofile.h" #include #include #include VirtFILE* StdioFileSystem::Vfopen(const char* path,const char*mode) { //printFM("Vfopen %s %s",path,mode); #ifdef USE_MFILE MFILE *f=mfopen(path,mode); #else FILE *f=fopen(path,mode); #endif //printFM("%p",f); if (f) return new StdioFILE(f,path); else return 0; } VirtDIR* StdioFileSystem::Vopendir(const char* path) { //printFM("Vopendir %s",path); DIR *d=opendir(path); //printFM("%p",d); if (d) return new StdioDIR(d); else return 0; } int StdioFileSystem::Vfexists(const char* path) { return fileExists(path); } void StdioFILE::setStdio() { static StdioFILEDontClose si(stdin); static StdioFILEDontClose so(stdout); static StdioFILEDontClose se(stderr); setVstdin(&si); setVstdout(&so); setVstderr(&se); } dirent* StdioDIR::Vreaddir() { //printFM("Vreaddir %s",dir); return readdir(dir); }