Removed file_exists() method. Glib::file_test() already exists and is available for use.

svn path=/trunk/; revision=1091
This commit is contained in:
Curtis Gedak 2009-03-13 14:17:22 +00:00
parent 2390671112
commit dbf81bc417
3 changed files with 6 additions and 32 deletions

View File

@ -1,3 +1,9 @@
2009-03-13 Curtis Gedak <gedakc@gmail.com>
* include/Utils.h,
src/Utils.cc: Removed file_exists() method.
- Glib::file_test() already exists and is available for use.
2009-03-12 Curtis Gedak <gedakc@gmail.com>
* include/Utils.h,

View File

@ -154,8 +154,6 @@ public:
static void tokenize( const Glib::ustring& str,
std::vector<Glib::ustring>& tokens,
const Glib::ustring& delimiters ) ;
static bool file_exists( const char* filename ) ;
static bool file_exists( const Glib::ustring& filename ) ;
};

View File

@ -21,7 +21,6 @@
#include <iomanip>
#include <regex.h>
#include <locale.h>
#include <sys/stat.h> //Used in file_exists() method
namespace GParted
@ -442,34 +441,5 @@ void Utils::tokenize( const Glib::ustring& str,
}
}
//The file_exists method copied and adapted from:
// http://wiki.forum.nokia.com/index.php/CS001101_-_Checking_if_a_file_exists_in_C_and_C%2B%2B
bool Utils::file_exists( const char* filename )
{
struct stat info ;
int ret = -1 ;
//get the file attributes
ret = stat(filename, &info) ;
if(ret == 0)
{
//stat() is able to get the file attributes,
//so the file obviously exists
return true ;
}
else
{
//stat() is not able to get the file attributes,
//so the file obviously does not exist or
//more capabilities is required
return false ;
}
}
bool Utils::file_exists( const Glib::ustring& filename )
{
return file_exists( filename .c_str() ) ;
}
} //GParted..