1
/***************************************************************************
2
* filesystem.h - header for the corresponding cpp file
4
* Copyright (C) 2005 - 2009 Florian Richter
5
***************************************************************************/
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3 of the License, or
10
(at your option) any later version.
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
#ifndef SMC_FILESYSTEM_H
17
#define SMC_FILESYSTEM_H
19
#include "../../core/global_basic.h"
20
//#include "../../core/global_game.h"
25
/* *** *** *** *** *** filesystem functions *** *** *** *** *** *** *** *** *** *** *** *** */
27
// Return the trimmed filename with the given options
28
std::string Trim_Filename( std::string filename, bool keep_dir = 1, bool keep_end = 1 );
30
// Check if the file exists
31
bool File_Exists( const std::string &filename );
32
// Check if the directory exists
33
bool Dir_Exists( const std::string &dir );
34
/* Deletes the given file
40
bool Delete_File( const std::string &filename );
42
bool Create_Directory( const std::string &dir );
43
/* Get the file size in bytes
44
* returns 0 if the file does not exist
46
size_t Get_File_Size( const std::string &filename );
48
// Converts "\" and "!" to "/"
49
void Convert_Path_Separators( std::string &str );
51
/* Get all files from the directory
52
* dir : the directory to scan
53
* file_type : if set only this file type is returned
54
* with_directories : if set adds directories to the returned objects
55
* search_in_sub_directories : searches in every sub-directory
57
vector<std::string> Get_Directory_Files( const std::string &dir, const std::string &file_type = "", bool with_directories = 0, bool search_in_sub_directories = 1 );
59
// Return the operating system temporary files directory
60
std::string Get_Temp_Directory( void );
61
// Return the default smc user directory in the operating system application/home directory
62
std::string Get_User_Directory( void );
64
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */