Edit

kc3-lang/angle/scripts/file_exists.py

Branch :

  • Show log

    Commit

  • Author : Yuxin Hu
    Date : 2022-02-24 20:59:57
    Hash : 1e1505b5
    Message : Upgrade Python scripts from Python2 to Python3 Bug: angleproject:5707 Change-Id: I2c00ef7e7cb529eab2be61378c9a5511a69acd1a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3486298 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>

  • scripts/file_exists.py
  • #!/usr/bin/python3
    # Copyright 2019 The ANGLE Project Authors. All rights reserved.
    # Use of this source code is governed by a BSD-style license that can be
    # found in the LICENSE file.
    #
    # Simple helper for use in 'gn' files to check if a file exists.
    
    from __future__ import print_function
    
    import os, shutil, sys
    
    
    def main():
        if len(sys.argv) != 2:
            print("Usage: %s <path>" % sys.argv[0])
            sys.exit(1)
    
        if os.path.exists(sys.argv[1]):
            print("true")
        else:
            print("false")
        sys.exit(0)
    
    
    if __name__ == '__main__':
        main()