Removed file_exists() method. Glib::file_test() already exists and is available for use.
svn path=/trunk/; revision=1091
This commit is contained in:
parent
2390671112
commit
dbf81bc417
|
@ -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,
|
||||
|
|
|
@ -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 ) ;
|
||||
};
|
||||
|
||||
|
||||
|
|
30
src/Utils.cc
30
src/Utils.cc
|
@ -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..
|
||||
|
|
Loading…
Reference in New Issue