#ifndef FILEMANAGER_H
#define FILEMANAGER_H

#include <string>
#include <vector>

#include "filesystem/file.h"

class StreamBase;

class FileManager
{
public:
	FileManager();
	~FileManager();

	void SetDefaultPath(const char* path);
	const char* GetDefaultPath() { return m_defaultPath; }

	bool FileExist(const char* filename);

	File* OpenFile(const char* path, FileAccess access);
	void CloseFile(File*& file);

	StreamBase* OpenStream(const char* fname, FileAccess access);

private:
	const char* m_defaultPath;
};

extern FileManager* g_fileManager;

void GetFileListFromFolder(const char* path, const char* findingPattern, std::vector<std::string>& filesList);

void osResolvePath(char* path);
bool osDirectoryIsExist(const char* path);
void osCreateDirectory(const char* path);

// Filename helper

namespace fs
{
	std::string getFileExtension(const std::string& filename);
	std::string getFilePath(const std::string& filename);
	std::string getFileNameWithoutExtension(const std::string& filename);
	std::string getFilenameWithoutPath(const std::string& filename);
	std::string getFilenameWithoutPathAndExtension(const std::string& filename);
};


#endif // !FILEMANAGER_H
