Merge pull request #1309 from leon-richardt/sort-filelist

Sort File Names When Updating File List
This commit is contained in:
pajlada 2019-09-25 03:53:20 -07:00 committed by GitHub
commit c25ac38aa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,12 +10,16 @@ data = ""
with open(filename, 'r') as project:
data = project.read()
sources = subprocess.getoutput("find ./src -type f -regex '.*\.cpp' | sed 's_\./_ _g'")
sources_list = subprocess.getoutput("find ./src -type f -regex '.*\.cpp' | sed 's_\./_ _g'").splitlines()
sources_list.sort(key=str.lower)
sources = "\n".join(sources_list)
sources = re.sub(r'$', r' \\\\', sources, flags=re.MULTILINE)
sources += "\n"
data = re.sub(r'^SOURCES(.|\r|\n)*?^$', 'SOURCES += \\\n' + sources, data, flags=re.MULTILINE)
headers = subprocess.getoutput("find ./src -type f -regex '.*\.hpp' | sed 's_\./_ _g'")
headers_list = subprocess.getoutput("find ./src -type f -regex '.*\.hpp' | sed 's_\./_ _g'").splitlines()
headers_list.sort(key=str.lower)
headers = "\n".join(headers_list)
headers = re.sub(r'$', r' \\\\', headers, flags=re.MULTILINE)
headers += "\n"
data = re.sub(r'^HEADERS(.|\r|\n)*?^$', 'HEADERS += \\\n' + headers, data, flags=re.MULTILINE)