• Jesse McKenna's avatar
    boilerplate.py: Ignore current-dir prefixes .\, ./ · 9d14b9ec
    Jesse McKenna authored
    This change makes boilerplate.py trim a leading ".\" (Windows's
    current-directory prefix) or "./" (Unix's current-directory prefix)
    from the filename argument, if present.
    
    This is a convenience change for cases where the current-directory
    prefix is prepended. For example, Windows PowerShell automatically
    prepends ".\" to a path when tab completion is used (e.g., typing
    "chrome/b" and pressing tab results in ".\chrome\browser"). This
    change will remove artifacts of this for users who use tab completion
    while typing the filename argument.
    
    Currently:
    `tools/boilerplate.py .\test.h` produces include guard `__TEST_H_`
    `tools/boilerplate.py ./test.cc` or `.mm` produces `#include "./test.h"`
    
    With this change:
    `tools/boilerplate.py .\test.h` produces include guard `TEST_H_`
    `tools/boilerplate.py ./test.cc` or `.mm` produces `#include "test.h"`
    
    Change-Id: I19fd2e72c58135b5e87d4a1e22ec8bc76ef326aa
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2157876
    Commit-Queue: Jesse McKenna <jessemckenna@google.com>
    Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#761085}
    9d14b9ec
boilerplate.py 3.47 KB