Fix PASV reply for Firefox.
[dftpd.git] / Filesystem.hpp
blobba6b65b2d1456bb9d44c32ccd814e3cd02bad9db
1 #ifndef __DFTPD__FILESYSTEM_HPP__
2 #define __DFTPD__FILESYSTEM_HPP__
4 #include <stdio.h>
5 #include <string>
6 #include <list>
7 #include <boost/shared_ptr.hpp>
8 #include "String.hpp"
10 #ifdef SYMBIAN
11 #include <f32file.h>
12 #endif
14 class Filesystem
16 public:
17 enum Mode
19 M_READ,
20 M_WRITE
23 Filesystem( const std::string& root );
24 ~Filesystem();
26 const std::string& GetPath() const { return m_path; }
27 bool ChangeDirectory( const std::string& cd );
29 bool FileExists( const std::string& file );
30 FILE* FileOpen( const std::string& file, Mode mode );
32 #ifdef SYMBIAN
33 RFile* FileOpenSymbian( const std::string& file, Mode mode );
34 #endif
36 std::list<std::string> GetListing( const std::string& path );
38 bool Delete( const std::string& file );
39 std::string MkDir( const std::string& dir );
40 bool RmDir( const std::string& dir );
42 private:
43 std::string MakePath( const PathVector& pv );
44 bool DirectoryExists( const std::string& dir );
45 bool TryChangePath( const PathVector& reqPath, PathVector& path );
46 bool CheckFileExists( const std::string& file );
47 std::string GetFilePath( const std::string& path );
48 PathVector SplitProperPath( const std::string& path );
50 std::string m_root;
51 std::string m_path;
53 #ifdef SYMBIAN
54 RFs m_rfs;
55 #endif
58 typedef boost::shared_ptr<Filesystem> FilesystemPtr;
60 #endif