Commit ae4d1a1c authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Handle the case mimetypes.guess_type not able to detect file type of cpp files



Seems to be the case on Summit (redhat)

Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent b4778bf2
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -550,6 +550,14 @@ def main(argv=None):
            filename = arg
            compile_qsharp(filename)

        # Fall-through handling of *.cpp file:
        # On certain platforms (e.g., RedHat), mimetypes.guess_type
        # may return None for cpp files.
        if os.path.isfile(arg) and os.path.splitext(arg)[1] == '.cpp':
            fileType = 'text/x-c++src'
            filename = arg
            break

    # If it is a C++ file
    if fileType != None and 'text/x-c' in fileType:
        fileIdx = sys.argv[1:].index(filename)