Merge pull request #21227 from sbwilson:fix_framework_unicode_headers
* fix unicode errors for framework headers This would crash if the header file included non-ASCII characters. This change ensures that headers are read and written as UTF-8 encoded files instead of ascii. * Adds spaces after commas
This commit is contained in:
parent
7ba56a4b88
commit
c08954c18b
@ -406,11 +406,11 @@ class Builder:
|
|||||||
for dirname, dirs, files in os.walk(os.path.join(dstdir, "Headers")):
|
for dirname, dirs, files in os.walk(os.path.join(dstdir, "Headers")):
|
||||||
for filename in files:
|
for filename in files:
|
||||||
filepath = os.path.join(dirname, filename)
|
filepath = os.path.join(dirname, filename)
|
||||||
with open(filepath) as file:
|
with codecs.open(filepath, "r", "utf-8") as file:
|
||||||
body = file.read()
|
body = file.read()
|
||||||
body = body.replace("include \"opencv2/", "include \"" + name + "/")
|
body = body.replace("include \"opencv2/", "include \"" + name + "/")
|
||||||
body = body.replace("include <opencv2/", "include <" + name + "/")
|
body = body.replace("include <opencv2/", "include <" + name + "/")
|
||||||
with open(filepath, "w") as file:
|
with codecs.open(filepath, "w", "utf-8") as file:
|
||||||
file.write(body)
|
file.write(body)
|
||||||
if self.build_objc_wrapper:
|
if self.build_objc_wrapper:
|
||||||
copy_tree(os.path.join(builddirs[0], "install", "lib", name + ".framework", "Headers"), os.path.join(dstdir, "Headers"))
|
copy_tree(os.path.join(builddirs[0], "install", "lib", name + ".framework", "Headers"), os.path.join(dstdir, "Headers"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user