Robot Framework Integrated Development Environment (RIDE)
robotide.lib.robot.utils.robotpath Namespace Reference

Functions

def _abspath (path)
 
def _common_path (p1, p2)
 Returns the longest path common to p1 and p2. More...
 
def _find_absolute_path (path)
 
def _find_relative_path (path, basedir)
 
def _get_link_path (target, base)
 
def _is_valid_file (path)
 
def abspath (path, case_normalize=False)
 Replacement for os.path.abspath with some enhancements and bug fixes. More...
 
def find_file (path, basedir='.', file_type=None)
 
def get_link_path (target, base)
 Returns a relative path to target from base. More...
 
def normpath (path, case_normalize=False)
 Replacement for os.path.normpath with some enhancements. More...
 
def path_to_url (path)
 

Variables

 _abspath
 
bool CASE_INSENSITIVE_FILESYSTEM = True
 

Function Documentation

◆ _abspath()

def robotide.lib.robot.utils.robotpath._abspath (   path)
private

Definition at line 30 of file robotpath.py.

◆ _common_path()

def robotide.lib.robot.utils.robotpath._common_path (   p1,
  p2 
)
private

Returns the longest path common to p1 and p2.

Rationale: as os.path.commonprefix is character based, it doesn't consider
path separators as such, so it may return invalid paths:
commonprefix(('/foo/bar/', '/foo/baz.txt')) -> '/foo/ba' (instead of /foo)

Definition at line 135 of file robotpath.py.

◆ _find_absolute_path()

def robotide.lib.robot.utils.robotpath._find_absolute_path (   path)
private

Definition at line 161 of file robotpath.py.

◆ _find_relative_path()

def robotide.lib.robot.utils.robotpath._find_relative_path (   path,
  basedir 
)
private

Definition at line 167 of file robotpath.py.

◆ _get_link_path()

def robotide.lib.robot.utils.robotpath._get_link_path (   target,
  base 
)
private

Definition at line 107 of file robotpath.py.

◆ _is_valid_file()

def robotide.lib.robot.utils.robotpath._is_valid_file (   path)
private

Definition at line 179 of file robotpath.py.

◆ abspath()

def robotide.lib.robot.utils.robotpath.abspath (   path,
  case_normalize = False 
)

Replacement for os.path.abspath with some enhancements and bug fixes.

1. Non-Unicode paths are converted to Unicode using file system encoding.
2. Optionally lower-case paths on case-insensitive file systems.
   That includes Windows and also OSX in default configuration.
3. Turn ``c:`` into ``c:\\`` on Windows instead of ``c:\\current\\path``.

Definition at line 87 of file robotpath.py.

◆ find_file()

def robotide.lib.robot.utils.robotpath.find_file (   path,
  basedir = '.',
  file_type = None 
)

Definition at line 146 of file robotpath.py.

◆ get_link_path()

def robotide.lib.robot.utils.robotpath.get_link_path (   target,
  base 
)

Returns a relative path to target from base.

If ``base`` is an existing file, then its parent directory is considered to
be the base. Otherwise ``base`` is assumed to be a directory.

The returned path is URL encoded. On Windows returns an absolute path with
``file:`` prefix if the target is on a different drive.

Definition at line 100 of file robotpath.py.

◆ normpath()

def robotide.lib.robot.utils.robotpath.normpath (   path,
  case_normalize = False 
)

Replacement for os.path.normpath with some enhancements.

1. Convert non-Unicode paths to Unicode using the file system encoding.
2. NFC normalize Unicode paths (affects mainly OSX).
3. Optionally lower-case paths on case-insensitive file systems.
   That includes Windows and also OSX in default configuration.
4. Turn ``c:`` into ``c:\\`` on Windows instead of keeping it as ``c:``.

Definition at line 68 of file robotpath.py.

◆ path_to_url()

def robotide.lib.robot.utils.robotpath.path_to_url (   path)

Definition at line 46 of file robotpath.py.

Variable Documentation

◆ _abspath

robotide.lib.robot.utils.robotpath._abspath
private

Definition at line 41 of file robotpath.py.

◆ CASE_INSENSITIVE_FILESYSTEM

bool robotide.lib.robot.utils.robotpath.CASE_INSENSITIVE_FILESYSTEM = True

Definition at line 52 of file robotpath.py.