Show
Ignore:
Timestamp:
08/05/08 15:41:53 (4 years ago)
Author:
robert
Message:

Added permission check and error logging

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/vpb/FileUtils.cpp

    r920 r924  
    22#include <vpb/BuildLog> 
    33#include <osgDB/FileUtils> 
     4#include <osgDB/FileNameUtils> 
    45 
    56#ifdef WIN32 
     
    138139     
    139140} 
     141 
     142bool vpb::hasWritePermission(const std::string& filename) 
     143{ 
     144    log(osg::NOTICE,"vpb::access(%s, W_OK)=%i",filename.c_str(), vpb::access(filename.c_str(), W_OK)); 
     145 
     146    if (vpb::access(filename.c_str(), W_OK)==0) return true; 
     147 
     148    std::string path = osgDB::getFilePath(filename); 
     149    if (path.empty()) path = "."; 
     150     
     151    log(osg::NOTICE,"vpb::access(%s, W_OK)=%i",path.c_str(), vpb::access(path.c_str(), W_OK)); 
     152 
     153    return (vpb::access(path.c_str(), W_OK)==0); 
     154} 
     155