/*------------------------------------------------------------------------------
 src/lib/dj/djDir.h
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

#ifndef DJ_DIR_H
#define DJ_DIR_H
#include <djFileInfo.h>

namespace dj {

// Directory.
//
class Dir {
public:

  Dir();
  Dir(const Str &);

  // Set.
  //
  void set(const Str &);
  void cd(const Str &);
  void up();
  void home();
  void root();
  
  // Get.
  //
  const Str get() const;
  const List<FileInfo> itemList() const;
  bool isValid() const { return _isValid; }

private:

  void updateValid();
  
  void init();
  
  StrList _path;
  bool _absolute;
  bool _isValid;
};

// Functions.
//
const Str dirPathAbsolute(const Str &);
const Str dirPathFix(const Str &);
const StrList dirPathFix(const StrList &);

}

#endif
