Fixed Homebrew again
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1423 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9d9c2fc983
commit
3b20086dc3
|
@ -42,17 +42,28 @@
|
||||||
namespace File
|
namespace File
|
||||||
{
|
{
|
||||||
|
|
||||||
inline void stripTailDirSlashes(std::string& fname) {
|
|
||||||
while(fname.at(fname.length() - 1) == DIR_SEP_CHR)
|
// =======================================================
|
||||||
fname.resize(fname.length() - 1);
|
// Remove any ending forward slashes from directory paths
|
||||||
|
// -------------
|
||||||
|
inline void StripTailDirSlashes(std::string& fname)
|
||||||
|
{
|
||||||
|
// Make sure it's not a blank string
|
||||||
|
if(fname.length() > 0)
|
||||||
|
{
|
||||||
|
while(fname.at(fname.length() - 1) == DIR_SEP_CHR)
|
||||||
|
fname.resize(fname.length() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// =============
|
||||||
|
|
||||||
|
|
||||||
bool Exists(const char *filename)
|
bool Exists(const char *filename)
|
||||||
{
|
{
|
||||||
struct stat file_info;
|
struct stat file_info;
|
||||||
|
|
||||||
std::string copy = filename;
|
std::string copy = filename;
|
||||||
stripTailDirSlashes(copy);
|
StripTailDirSlashes(copy);
|
||||||
|
|
||||||
int result = stat(copy.c_str(), &file_info);
|
int result = stat(copy.c_str(), &file_info);
|
||||||
return (result == 0);
|
return (result == 0);
|
||||||
|
@ -62,7 +73,7 @@ bool IsDirectory(const char *filename)
|
||||||
{
|
{
|
||||||
struct stat file_info;
|
struct stat file_info;
|
||||||
std::string copy = filename;
|
std::string copy = filename;
|
||||||
stripTailDirSlashes(copy);
|
StripTailDirSlashes(copy);
|
||||||
|
|
||||||
int result = stat(copy.c_str(), &file_info);
|
int result = stat(copy.c_str(), &file_info);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
|
|
Loading…
Reference in New Issue