From dbf81bc417bc852a07b3758fe7e400330b7148d4 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Fri, 13 Mar 2009 14:17:22 +0000 Subject: [PATCH] Removed file_exists() method. Glib::file_test() already exists and is available for use. svn path=/trunk/; revision=1091 --- ChangeLog | 6 ++++++ include/Utils.h | 2 -- src/Utils.cc | 30 ------------------------------ 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3b401b8..f3191a1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-13 Curtis Gedak + + * 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 * include/Utils.h, diff --git a/include/Utils.h b/include/Utils.h index 7157b43b..c1eb8674 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -154,8 +154,6 @@ public: static void tokenize( const Glib::ustring& str, std::vector& tokens, const Glib::ustring& delimiters ) ; - static bool file_exists( const char* filename ) ; - static bool file_exists( const Glib::ustring& filename ) ; }; diff --git a/src/Utils.cc b/src/Utils.cc index 2ff921eb..35d4a7f6 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -21,7 +21,6 @@ #include #include #include -#include //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..