Module FSDB::PathUtilities
In: lib/fsdb/util.rb
Module: FSDB

Extends FSDB:Databases to have methods for validating and normalizing paths, path globbing, directory traversal, making links, ...

canonical    canonical?    directory?    glob    valid?    validate   
Classes and Modules
Class FSDB::PathUtilities::InvalidPathError
Public Instance methods

Attempts to convert a path to a canonical form so that '/foo/bar', 'foo/bar', 'foo//bar', and 'foo/zap/../bar' all result in the same path. The canonical form is the simplest.

Doesn't remove trailing '/', which indicates directory.

This is not necessary for database access, it's just for display purposes and for validation.


Is the path in the simplest, canonical representation?


Does the path refer to an object within the database? This doesn't check for links.


Raises InvalidPathError if canonical(path) still has embedded '..', which means the path would refer to a file not below the database directory. Returns the canonical path, otherwise.


Dir globbing. (Not protected. Use inside of 'browse dir'.) Excludes '.' and all '..*' files. Returns sorted array of strings to help avoid deadlock when doing nested transactions.


Use this to check whether a path yielded by an iterator is a directory.