eric6/Utilities/__init__.py

changeset 8205
4a0f1f896341
parent 8143
2c730d5fd177
child 8217
385f60c94548
equal deleted inserted replaced
8204:fd477cded1c1 8205:4a0f1f896341
832 832
833 def startswithPath(path, start): 833 def startswithPath(path, start):
834 """ 834 """
835 Function to check, if a path starts with a given start path. 835 Function to check, if a path starts with a given start path.
836 836
837 @param path path to be checked (string) 837 @param path path to be checked
838 @param start start path (string) 838 @type str
839 @param start start path
840 @type str
839 @return flag indicating that the path starts with the given start 841 @return flag indicating that the path starts with the given start
840 path (boolean) 842 path
841 """ 843 @rtype bool
842 if start: 844 """
843 if path == start: 845 return (
844 return True 846 bool(start) and
845 elif normcasepath(path).startswith( 847 (
846 normcasepath(start + "/")): 848 path == start or
847 return True 849 normcasepath(path).startswith(normcasepath(start + "/"))
848 else: 850 )
849 return False 851 )
850 else:
851 return False
852 852
853 853
854 def relativeUniversalPath(path, start): 854 def relativeUniversalPath(path, start):
855 """ 855 """
856 Function to convert a file path to a path relative to a start path 856 Function to convert a file path to a path relative to a start path

eric ide

mercurial