Skip to content

multiple header files will cause the script to fail #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RedCali opened this issue Jan 27, 2024 · 0 comments
Open

multiple header files will cause the script to fail #7

RedCali opened this issue Jan 27, 2024 · 0 comments

Comments

@RedCali
Copy link

RedCali commented Jan 27, 2024

In case the source has multiple .h file and the first one found isn't the right one., the script fails

myHeader_extension.h
myHeader.h (containing the class

extendoing the search for .h files will solve the issue:

# This function retrieves the directory path to the header file.
def get_path_to_header(sPath):
    foundHeader = False
    pathToHeader = ''
    for file in os.listdir(sPath):
        if file.endswith(".h"):
            if(confirm_header_file(sPath + os.sep + file)):
                pathToHeader = sPath + os.sep + file
                foundHeader = True
                
    if foundHeader:
        return pathToHeader
    else:
        error_out(3, libData)

# This function confirms that there is a header file in teh Arduino Library 
# folder.
def confirm_header_file(fPath):
    print(fPath)
    with open(fPath, 'r') as h:
        for line in h:
            if "class" in line:
                return True
    return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant