Package topo :: Package misc :: Module filepaths
[hide private]
[frames] | no frames]

Module filepaths

source code

Functions and classes to simplify dealing with paths.

For portable code:

The location in which new files are created by default can be controlled by the output_path module attribute, which applies whenever a particular location is not specified explicitly.

$Id: filepaths.py 7915 2008-02-10 15:18:03Z ceball $




Version: $Revision: 7915 $

Classes [hide private]
  Filename
Filename is a Parameter that can be set to a string specifying the path of a file (in unix style), and returns it in the format of the user's operating system.
Functions [hide private]
 
resolve_path(path, search_paths=[])
Find the path to an existing file, searching in the specified search paths if the filename is not absolute, and converting a UNIX-style path to the current OS's format if necessary.
source code
 
normalize_path(path='', prefix=None)
Convert a UNIX-style path to the current OS's format, typically for creating a new file or directory.
source code
Variables [hide private]
  application_path = '/disk/home/lodestar1/jbednar/topographica-...
  output_path = '/disk/home/lodestar1/jbednar/topographica-svn/t...
Function Details [hide private]

resolve_path(path, search_paths=[])

source code 

Find the path to an existing file, searching in the specified search paths if the filename is not absolute, and converting a UNIX-style path to the current OS's format if necessary.

To turn a supplied relative path into an absolute one, the path is appended to each path in (search_paths+the current working directory+the application's base path), in that order, until the file is found.

(Similar to Python's os.path.abspath(), except more search paths than just os.getcwd() can be used, and the file must exist.)

An IOError is raised if the file is not found anywhere.

normalize_path(path='', prefix=None)

source code 

Convert a UNIX-style path to the current OS's format, typically for creating a new file or directory.

If the path is not already absolute, it will be made absolute (using the specified prefix, which defaults to filepaths.output_path) in the process.

(Should do the same as Python's os.path.abspath(), except using the specified prefix rather than os.getcwd().)


Variables Details [hide private]

application_path

Value:
'/disk/home/lodestar1/jbednar/topographica-svn/topographica'

output_path

Value:
'/disk/home/lodestar1/jbednar/topographica-svn/topographica'