/*
  Copyright (C) 2010-2011  Charles Pence <charles@charlespence.net>
  Copyright (C) 1996-1997  Id Software, Inc.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILESYSTEM_FILESYSTEM_H__
#define FILESYSTEM_FILESYSTEM_H__

namespace filesystem
{

// Initialize the filesystem.  Pass the value of argv[0] here from main().
extern void Init(const char *argv0);

// Shut down the filesystem.
extern void Shutdown();


// Add a directory to the filesystem, including all PAK files contained
// in that directory.
extern bool Add(const std::string &path);


//
// Path utilities
//

// Remove extension from a filename, but leave the rest of the path
// intact.
// "/tmp/asdf.txt" => "/tmp/asdf"
extern std::string PathWithoutExtension(const std::string &path);

// Get extension from filename.  Include the dot, so you can tell
// the difference between empty extension and no extension.
// "/tmp/asdf.txt" => ".txt"
extern std::string PathExtension(const std::string &path);

// Get filename portion without extension.  Like PathWithoutExtension, but
// strips off the path part, too.
// "/tmp/asdf.txt" => "asdf"
extern std::string PathStem(const std::string &path);

// Add extension to filename if it's not already present.
// "/tmp/asdf.txt" =".txt"> "/tmp/asdf.txt"
// "/tmp/asdf" =".txt"> "/tmp/asdf.txt"
extern std::string DefaultPathExtension(const std::string &path,
    const std::string &extension);

}

#endif /* FILESYSTEM_FILESYSTEM_H__ */
