nux-1.14.0
nux::NFileManagerGNU Class Reference
Inheritance diagram for nux::NFileManagerGNU:
nux::NFileManagerGeneric nux::NFileManager

List of all members.

Public Member Functions

virtual NSerializerCreateFileReader (const TCHAR *Filename, DWORD Flags, LogOutputDevice &Error=GNullDevice)
virtual NSerializerCreateFileWriter (const TCHAR *Filename, DWORD Flags, LogOutputDevice &Error=GNullDevice)
t_s64 FileSize (const TCHAR *Filename)
bool FileExist (const TCHAR *Filename)
int Copy (const TCHAR *DestFile, const TCHAR *SrcFile, bool OverWriteExisting, bool OverWriteReadOnly, NFileTransferMonitor *Monitor)
bool Move (const TCHAR *Dest, const TCHAR *Src, bool OverWriteExisting=true, bool OverWriteReadOnly=false, NFileTransferMonitor *Monitor=NULL)
bool Delete (const TCHAR *Filename, bool OverWriteReadOnly=false)
bool IsReadOnly (const TCHAR *Filename)
bool IsDirectory (const TCHAR *DirectoryName)
bool IsHidden (const TCHAR *Filename)
bool GetFileAttribute (const TCHAR *Filename, bool &isDirectory, bool &isReadOnly, bool &isHidden, t_s64 &Size)
bool MakeDirectory (const TCHAR *Path, bool CreateCompletePath=false)
bool DeleteDirectory (const TCHAR *Path, bool DeleteContentFirst=false)
 Delete directory.
void FindFiles (std::vector< NString > &Result, const TCHAR *Filename, bool Files, bool Directories)
void ListFilesInDirectory (std::vector< NString > &Result, const TCHAR *DirName)
double GetFileAgeSeconds (const TCHAR *Filename)
time_t GetFileLastModified (const TCHAR *Filename)
bool SetDefaultDirectory ()
NString GetCurrentDirectory ()
bool GetTimeStamp (const TCHAR *Filename, FileTimeStamp &Timestamp)

Detailed Description

Definition at line 98 of file NFileManagerGNU.h.


Member Function Documentation

bool nux::NFileManagerGNU::DeleteDirectory ( const TCHAR *  Path,
bool  DeleteContentFirst = false 
) [virtual]

Delete directory.

Delete a Directory. If DeleteContent is true, The content of the directory is deleted before the directory itself;

Parameters:
PathPath of the directory
DeleteContentFirstDelete the content of the directory before deleting the directory itself.
Returns:
TRUE if the directory was deleted.

Reimplemented from nux::NFileManagerGeneric.

Definition at line 692 of file NFileManagerGNU.cpp.

  {
//     if(DeleteContentFirst)
//     {
//         return NFileManagerGeneric::DeleteDirectory(Path, DeleteContentFirst);
//     }
//     if((::RemoveDirectory(Path) == 0) && (::GetLastError() != ERROR_FILE_NOT_FOUND))
//     {
//         nuxDebugMsg(TEXT("[NFileManagerWindows::DeleteDirectory] Error deleting directory '%s' (GetLastError: %d)"), Path, ::GetLastError());
//         return false;
//     }
    return true;
  }
t_s64 nux::NFileManagerGNU::FileSize ( const TCHAR *  Filename) [virtual]
Returns:
Size of the File. Return -1 if an error occurs.

Implements nux::NFileManager.

Definition at line 492 of file NFileManagerGNU.cpp.

  {
    struct stat sb;

    if (stat (TCHAR_TO_ANSI (Filename), &sb) != 0)
    {
      nuxDebugMsg (TEXT ("[NFileManagerGNU::FileSize] Can't get file size") );
      return 0;
    }

    if (sb.st_mode & S_IFDIR)
    {
      // This is a directory
      return 0;
    }

    return sb.st_size;
  }
bool nux::NFileManagerGNU::GetFileAttribute ( const TCHAR *  Filename,
bool &  isDirectory,
bool &  isReadOnly,
bool &  isHidden,
t_s64 &  Size 
) [virtual]
Returns:
TRUE is the file exist.

Implements nux::NFileManager.

Definition at line 637 of file NFileManagerGNU.cpp.

  {
    isDirectory = false;
    isReadOnly = false;
    isHidden = false;
    Size = 0;

    struct stat sb;

    if (stat (TCHAR_TO_ANSI (Filename), &sb) != 0)
    {
      return false;
    }

    if (sb.st_mode & S_IFDIR)
    {
      isDirectory = true;
    }

    if ( (sb.st_mode & S_IRUSR) && ! (sb.st_mode & S_IWUSR) )
    {
      isReadOnly = true;
    }

    Size = sb.st_mode;
    return true;
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends