Esempio n. 1
0
bool wxFile::Access(const wxString& name, OpenMode mode)
{
    int how;

    switch ( mode )
    {
    default:
        wxFAIL_MSG(wxT("bad wxFile::Access mode parameter."));
    // fall through

    case read:
        how = R_OK;
        break;

    case write:
        how = W_OK;
        break;

    case read_write:
        how = R_OK | W_OK;
        break;
    }

    return wxAccess(name, how) == 0;
}
Esempio n. 2
0
bool wxIsExecutable(const wxString &path)
{
#if defined( __UNIX__ )
    // access() will take in count also symbolic links
    return wxAccess(path.c_str(), X_OK) == 0;
#elif defined( __WINDOWS__ )
   return wxCheckWin32Permission(path, GENERIC_EXECUTE);
#else
    wxUnusedVar(path);
    // TODO
    return false;
#endif
}
Esempio n. 3
0
String
PathFinder::Find(const String & filename, bool *found,
                 int mode) const
{
    StringList::const_iterator i;
    String   work;
    int   result;

    MOcheck();
    for(i = pathList.begin(); i != pathList.end(); i++)
    {
        work = *i + String(DIR_SEPARATOR) + filename;
        result = wxAccess(work.c_str(),mode);
        if(result == 0)
        {
            if(found)   *found = true;
            return work;
        }
    }
    if(found)
        *found = false;
    return wxEmptyString;
}
Esempio n. 4
0
/* ------------------------------------------------------------------------------
 FileIsWritable
 ------------------------------------------------------------------------------ */
bool FileIsWritable(wxString const & AFilename)
{
	return (wxAccess(AFilename.c_str(), 02) == 0);
}
Esempio n. 5
0
/* ------------------------------------------------------------------------------
 function FileIsReadable(const AFilename: string): boolean;
 ------------------------------------------------------------------------------ */
bool FileIsReadable(wxString const & AFilename)
{
	return (wxAccess(AFilename.c_str(), 04) == 0);
}