I have the same problem too. Your option 1 is not as bad as you think, because you can script to create all the "directory" commands with something like this python code:
def get_directory_paths(): return_array = list() unix_path = os.path.join('my','unix','path') for root, dirs, files in os.walk(unix_path): for dir in dirs: full_unix_path = os.path.join(root,dir) escaped_unix_path = re.sub("\s", "\\\\ ", full_unix_path) return_array.insert(0, "directory " + escaped_unix_path) return '\n'.join(return_array)
The downside is that if you have two source files with the same name in different directories, I don't think gcc can choose the right one. This bothers me, but in my specific situation, I think I'm safe.
For option 2 (which, I suspect, will fix the C # 1 smoothing condition), I think the problem is that replacements do not end with a “file separator” according to Linux, so they do not apply:
To avoid unexpected substitution results, the rule only applies if part of the directory name ends in a directory delimiter. For example, the rule / substitution / usr / source in / mnt / cross will be applied to / usr / source / foo -1.0, but not to / usr / sourceware / foo -2.0. And since the substitution applies only at the beginning of the directory name, this rule will not apply to /root/usr/source/baz.c either. "(From https://sourceware.org/gdb/current/onlinedocs/gdb/Source-Path.html#index-set-substitute_002dpath )
I have not tried anything like your # 3, and I also looked at something like the @dragn suggestion, but in my situation the paths are not close to the same length, so there will be a problem.
I think I'm stuck in # 1 and the script, but if anyone has any other suggestions, I need options :-)
Mike miller
source share