1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 04:48:00 +01:00

Centralise path configuration into a single file.

Path configuration was distributed throughout wicd, making it difficult
to move around project files. Centralise the configuration into
wpath.py.
This commit is contained in:
metrics
2007-08-12 00:30:01 +00:00
parent 4e4e87423d
commit ca8810aa4a
8 changed files with 76 additions and 31 deletions

31
wpath.py Normal file
View File

@@ -0,0 +1,31 @@
"""Path configuration and functions for the wicd daemon and gui clients.
chdir() -- Change directory to the location of the current file.
"""
import os
# The path containing the wpath.py file.
current = os.path.dirname(os.path.realpath(__file__)) + '/'
# These paths can easily be modified to handle system wide installs, or
# they can be left as is if all files remain with the source directory
# layout.
lib = current
images = lib + 'images/'
encryption = lib + 'encryption/templates/'
bin = current
etc = current + 'data/'
networks = lib + 'encryption/configurations/'
log = current + 'data/'
def chdir(file):
"""Change directory to the location of the specified file.
Keyword arguments:
file -- the file to switch to (usually __file__)
"""
os.chdir(os.path.dirname(os.path.realpath(file)))