Subversion Repositories tpanel

Rev

Rev 71 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 88
Line 34... Line 34...
34
    DECL_TRACER("TValidateFile::isValidFile(const string& file)");
34
    DECL_TRACER("TValidateFile::isValidFile(const string& file)");
35
 
35
 
36
    struct stat buffer;
36
    struct stat buffer;
37
 
37
 
38
    if (stat (file.c_str(), &buffer) != 0)
38
    if (stat (file.c_str(), &buffer) != 0)
-
 
39
    {
-
 
40
        MSG_WARNING("File access error: " << strerror(errno));
39
        return false;
41
        return false;
-
 
42
    }
40
 
43
 
41
    if (buffer.st_mode == S_IFREG)
44
    if ((buffer.st_mode & S_IFREG) > 0)
42
        return true;
45
        return true;
43
 
46
 
44
    return true;
47
    return false;
45
}
48
}
46
 
49
 
47
bool TValidateFile::isValidDir(const string& path)
50
bool TValidateFile::isValidDir(const string& path)
48
{
51
{
49
    DECL_TRACER("TValidateFile::isValidDir(const string& path)");
52
    DECL_TRACER("TValidateFile::isValidDir(const string& path)");
Line 51... Line 54...
51
    struct stat buffer;
54
    struct stat buffer;
52
 
55
 
53
    if (stat (path.c_str(), &buffer) != 0)
56
    if (stat (path.c_str(), &buffer) != 0)
54
        return false;
57
        return false;
55
 
58
 
56
    if (buffer.st_mode == S_IFDIR)
59
    if ((buffer.st_mode & S_IFDIR) > 0)
57
        return true;
60
        return true;
58
 
61
 
59
    return true;
62
    return false;
60
}
63
}
61
 
64
 
62
std::string &TValidateFile::makeFileName(const std::string& path, const std::string& name)
65
std::string &TValidateFile::makeFileName(const std::string& path, const std::string& name)
63
{
66
{
64
    DECL_TRACER("TValidateFile::makeFileName(const std::string& path, const std::string& name)");
67
    DECL_TRACER("TValidateFile::makeFileName(const std::string& path, const std::string& name)");
65
 
68
 
66
    if (name.empty())
69
    if (name.empty())
67
    {
70
    {
-
 
71
        MSG_DEBUG("No file name given!");
68
        mFile.clear();
72
        mFile.clear();
69
        return mFile;
73
        return mFile;
70
    }
74
    }
71
 
75
 
72
    if (path.empty())
76
    if (path.empty())