INNER CODE UNIT · Python

fix_include_case

ixray-team/ixray-1.6-stcop · util/includes_case_fix.py:25

def fix_include_case(source_file, include_paths):

  source_dir = os.path.dirname(source_file)
  include_paths_with_local = include_paths + [source_dir]
  e = chardet.detect(open(source_file, 'rb').read())['encoding']
  with open(source_file, 'r', encoding=e) as f:
    try:
        lines = f.readlines()
    except:
        print("ERROR reading file ", source_file, e)
        raise 
  changed = False
  for ln in range(len(lines)):
      line = lines[ln]
      match = REGEX_INCLUDE_FILE.match(line)
      if match:
        include = match.group(1) or match.group(2)
        (left_delim, right_delim) = ('"', '"') if match.group(1) else ('<', '>')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…