~ubuntu-branches/ubuntu/trusty/smc/trusty

« back to all changes in this revision

Viewing changes to src/core/filesystem/filesystem.h

  • Committer: Bazaar Package Importer
  • Author(s): Muammar El Khatib
  • Date: 2009-08-18 11:28:01 UTC
  • mfrom: (1.1.7 upstream) (5.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090818112801-qfhdmqouq8m1fwab
Tags: 1.9-1
* New upstream release.
* Bumped standards version to 3.8.3. No changes were needed in order to 
  accomplish this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 * filesystem.h  -  header for the corresponding cpp file
 
3
 *
 
4
 * Copyright (C) 2005 - 2009 Florian Richter
 
5
 ***************************************************************************/
 
6
/*
 
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.
 
11
   
 
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/>.
 
14
*/
 
15
 
 
16
#ifndef SMC_FILESYSTEM_H
 
17
#define SMC_FILESYSTEM_H
 
18
 
 
19
#include "../../core/global_basic.h"
 
20
//#include "../../core/global_game.h"
 
21
 
 
22
namespace SMC
 
23
{
 
24
 
 
25
/* *** *** *** *** *** filesystem functions *** *** *** *** *** *** *** *** *** *** *** *** */
 
26
 
 
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 );
 
29
 
 
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
 
35
 * Use with Caution
 
36
 *
 
37
 * Returns:
 
38
 * true on success
 
39
*/
 
40
bool Delete_File( const std::string &filename );
 
41
// Create directory
 
42
bool Create_Directory( const std::string &dir );
 
43
/* Get the file size in bytes 
 
44
* returns 0 if the file does not exist
 
45
*/
 
46
size_t Get_File_Size( const std::string &filename );
 
47
 
 
48
// Converts "\" and "!" to "/"
 
49
void Convert_Path_Separators( std::string &str );
 
50
 
 
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
 
56
*/
 
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 );
 
58
 
 
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 );
 
63
 
 
64
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 
65
 
 
66
} // namespace SMC
 
67
 
 
68
#endif