SGPath: typo...

This commit is contained in:
Thomas Geymayer
2014-01-28 00:42:20 +01:00
parent 0d19be2196
commit c54b1e037a
3 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -192,12 +192,12 @@ int main(int argc, char* argv[])
pp.append("./test-dir/file.txt"); pp.append("./test-dir/file.txt");
COMPARE(pp.create_dir(0700), -3); COMPARE(pp.create_dir(0700), -3);
pp.setPermissonChecker(&validateRead); pp.setPermissionChecker(&validateRead);
COMPARE(pp.canRead(), true); COMPARE(pp.canRead(), true);
COMPARE(pp.canWrite(), false); COMPARE(pp.canWrite(), false);
COMPARE(pp.create_dir(0700), -3); COMPARE(pp.create_dir(0700), -3);
pp.setPermissonChecker(&validateWrite); pp.setPermissionChecker(&validateWrite);
COMPARE(pp.canRead(), false); COMPARE(pp.canRead(), false);
COMPARE(pp.canWrite(), true); COMPARE(pp.canWrite(), true);
+8 -8
View File
@@ -75,7 +75,7 @@ static SGPath pathForCSIDL(int csidl, const SGPath& def)
char path[MAX_PATH]; char path[MAX_PATH];
if (SHGetSpecialFolderPath(0, path, csidl, false)) { if (SHGetSpecialFolderPath(0, path, csidl, false)) {
return SGPath(path, def.getPermissonChecker()); return SGPath(path, def.getPermissionChecker());
} }
return def; return def;
@@ -95,7 +95,7 @@ static SGPath appleSpecialFolder(OSType type, const SGPath& def)
if( FSRefMakePath(&ref, path, 1024) != noErr ) if( FSRefMakePath(&ref, path, 1024) != noErr )
return def; return def;
return SGPath((const char*) path, def.getPermissonChecker()); return SGPath((const char*) path, def.getPermissionChecker());
} }
#else #else
static SGPath getXDGDir( const std::string& name, static SGPath getXDGDir( const std::string& name,
@@ -131,7 +131,7 @@ static SGPath getXDGDir( const std::string& name,
return SGPath::home(def) return SGPath::home(def)
/ simgear::strutils::unescape(line.substr(HOME.length())); / simgear::strutils::unescape(line.substr(HOME.length()));
return SGPath(line, def.getPermissonChecker()); return SGPath(line, def.getPermissionChecker());
} }
if( def.isNull() ) if( def.isNull() )
@@ -160,7 +160,7 @@ SGPath::fix()
// default constructor // default constructor
SGPath::SGPath(PermissonChecker validator) SGPath::SGPath(PermissionChecker validator)
: path(""), : path(""),
_permission_checker(validator), _permission_checker(validator),
_cached(false), _cached(false),
@@ -171,7 +171,7 @@ SGPath::SGPath(PermissonChecker validator)
// create a path based on "path" // create a path based on "path"
SGPath::SGPath( const std::string& p, PermissonChecker validator ) SGPath::SGPath( const std::string& p, PermissionChecker validator )
: path(p), : path(p),
_permission_checker(validator), _permission_checker(validator),
_cached(false), _cached(false),
@@ -184,7 +184,7 @@ SGPath::SGPath( const std::string& p, PermissonChecker validator )
// create a path based on "path" and a "subpath" // create a path based on "path" and a "subpath"
SGPath::SGPath( const SGPath& p, SGPath::SGPath( const SGPath& p,
const std::string& r, const std::string& r,
PermissonChecker validator ) PermissionChecker validator )
: path(p.path), : path(p.path),
_permission_checker(validator), _permission_checker(validator),
_cached(false), _cached(false),
@@ -240,14 +240,14 @@ void SGPath::set( const string& p ) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SGPath::setPermissonChecker(PermissonChecker validator) void SGPath::setPermissionChecker(PermissionChecker validator)
{ {
_permission_checker = validator; _permission_checker = validator;
_rwCached = false; _rwCached = false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
SGPath::PermissonChecker SGPath::getPermissonChecker() const SGPath::PermissionChecker SGPath::getPermissionChecker() const
{ {
return _permission_checker; return _permission_checker;
} }
+7 -7
View File
@@ -57,10 +57,10 @@ public:
bool read : 1; bool read : 1;
bool write : 1; bool write : 1;
}; };
typedef Permissions (*PermissonChecker)(const SGPath&); typedef Permissions (*PermissionChecker)(const SGPath&);
/** Default constructor */ /** Default constructor */
explicit SGPath(PermissonChecker validator = NULL); explicit SGPath(PermissionChecker validator = NULL);
/** Copy contructor */ /** Copy contructor */
SGPath(const SGPath& p); SGPath(const SGPath& p);
@@ -71,7 +71,7 @@ public:
* Construct a path based on the starting path provided. * Construct a path based on the starting path provided.
* @param p initial path * @param p initial path
*/ */
SGPath( const std::string& p, PermissonChecker validator = NULL ); SGPath( const std::string& p, PermissionChecker validator = NULL );
/** /**
* Construct a path based on the starting path provided and a relative subpath * Construct a path based on the starting path provided and a relative subpath
@@ -80,7 +80,7 @@ public:
*/ */
SGPath( const SGPath& p, SGPath( const SGPath& p,
const std::string& r, const std::string& r,
PermissonChecker validator = NULL ); PermissionChecker validator = NULL );
/** Destructor */ /** Destructor */
~SGPath(); ~SGPath();
@@ -95,8 +95,8 @@ public:
bool operator==(const SGPath& other) const; bool operator==(const SGPath& other) const;
bool operator!=(const SGPath& other) const; bool operator!=(const SGPath& other) const;
void setPermissonChecker(PermissonChecker validator); void setPermissionChecker(PermissionChecker validator);
PermissonChecker getPermissonChecker() const; PermissionChecker getPermissionChecker() const;
/** /**
* Set if file information (exists, type, mod-time) is cached or * Set if file information (exists, type, mod-time) is cached or
@@ -301,7 +301,7 @@ private:
void checkAccess() const; void checkAccess() const;
std::string path; std::string path;
PermissonChecker _permission_checker; PermissionChecker _permission_checker;
mutable bool _cached : 1; mutable bool _cached : 1;
mutable bool _rwCached : 1; mutable bool _rwCached : 1;