util/paths.py
changeset 2736 a81b72ef156c
parent 2434 07f48018b6f5
child 3501 fa291393aac7
equal deleted inserted replaced
2735:732d112dd902 2736:a81b72ef156c
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
    27 import os
    27 import os
    28 import sys
    28 import sys
    29 from builtins import str as text
    29 from builtins import str as text
    30 
    30 
    31 
       
    32 def AbsFile(file):
    31 def AbsFile(file):
    33     if isinstance(file, str):
    32     if isinstance(file, str):
    34         file = text(file, sys.getfilesystemencoding())
    33         file = text(file, sys.getfilesystemencoding())
    35     return file
    34     return file
    36 
    35 
    47 def AbsParentDir(file, level=1):
    46 def AbsParentDir(file, level=1):
    48     path = AbsDir(file)
    47     path = AbsDir(file)
    49     for dummy in range(0, level):
    48     for dummy in range(0, level):
    50         path = os.path.dirname(path)
    49         path = os.path.dirname(path)
    51     return path
    50     return path
       
    51 
       
    52 def ThirdPartyPath(name):
       
    53     """
       
    54     Return folder where to find sibling projects like Modbus, CanFestival, BACnet
       
    55     """
       
    56     return os.path.join(AbsParentDir(__file__, 2), name)
       
    57