code: def trim_path(path, length=30):
      
      s = path.replace('\\', '/').split('/')
      t = -1
      for i in range(len(s)-1, -1, -1):
          t = len(s[i]) + t + 1
          if t > length-4:
              break
      return '.../' + '/'.join(s[i+1:])
docs: trim path to specified length, for example:
      >>> a = '/project/apps/default/settings.ini'
      >>> trim_path(a)
      '.../apps/default/settings.ini'
      
      The real length will be length-4, it'll left '.../' for output.