Ignore:
Timestamp:
01/15/15 22:43:01 (9 years ago)
Author:
Maciej Komosinski
Message:

Reorganizations and extensions of directory/file/filesystem IO classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/virtfile/virtfile.cpp

    r286 r295  
    2222}
    2323
    24 int Vfexists(const char* path)
     24bool Vfexists(const char* path)
    2525{
    26 return VirtFILE::vfs ? VirtFILE::vfs->Vfexists(path) : 0;
     26return VirtFILE::vfs ? VirtFILE::vfs->Vfexists(path) : false;
     27}
     28
     29bool Vdirexists(const char* path,bool is_writable)
     30{
     31return VirtFILE::vfs ? VirtFILE::vfs->Vdirexists(path,is_writable) : false;
     32}
     33
     34bool Vmkdir(const char* path)
     35{
     36return VirtFILE::vfs ? VirtFILE::vfs->Vmkdir(path) : false;
     37}
     38
     39bool Vmkdirs(const char* path)
     40{
     41return VirtFILE::vfs ? VirtFILE::vfs->Vmkdirs(path) : false;
    2742}
    2843
     
    6580
    6681VirtFILE* VirtFileSystem::Vfopen(const char* path,const char*mode) {return 0;}
    67 int VirtFileSystem::Vfexists(const char* path) {return 0;}
     82bool VirtFileSystem::Vfexists(const char* path) {return 0;}
    6883VirtDIR* VirtFileSystem::Vopendir(const char* path) {return 0;}
     84bool VirtFileSystem::Vmkdir(const char* path) {return false;} //error - not supported
     85bool VirtFileSystem::Vdirexists(const char* path,bool is_writable) {return false;}
    6986
    7087//////////////////////////////////////////////////////////////////////////
     
    117134dirent* readdir(VirtDIR* d) {return d->Vreaddir();}
    118135
     136/////////
     137
     138bool VirtFileSystem::Vmkdirs(const char* path)
     139{
     140if (Vdirexists(path,true)) return true;
     141string parentdir = getFileDir(path);
     142if (!Vmkdirs(parentdir.c_str())) return false;
     143return Vmkdir(path);
     144}
     145
     146//////////
     147
     148VirtFILE *ChainFileSystem::Vfopen(const char* path, const char*mode)
     149{
     150        return (chain != NULL) ? chain->Vfopen(path, mode) : NULL;
     151}
     152
     153bool ChainFileSystem::Vfexists(const char* path)
     154{
     155        return (chain != NULL) ? chain->Vfexists(path) : false;
     156}
     157
     158VirtDIR *ChainFileSystem::Vopendir(const char* path)
     159{
     160        return (chain != NULL) ? chain->Vopendir(path) : NULL;
     161}
     162
     163bool ChainFileSystem::Vmkdir(const char* path)
     164{
     165        return (chain != NULL) ? chain->Vmkdir(path) : false;
     166}
     167
     168bool ChainFileSystem::Vmkdirs(const char* path)
     169{
     170        return (chain != NULL) ? chain->Vmkdirs(path) : false;
     171}
     172
     173bool ChainFileSystem::Vdirexists(const char* path,bool is_writable)
     174{
     175        return (chain != NULL) ? chain->Vdirexists(path,is_writable) : false;
     176}
Note: See TracChangeset for help on using the changeset viewer.