Skip to content

Instantly share code, notes, and snippets.

@JohannMG
Created May 5, 2016 21:12
Show Gist options
  • Save JohannMG/1416a59faff1b903650f7877c6d7d9b0 to your computer and use it in GitHub Desktop.
Save JohannMG/1416a59faff1b903650f7877c6d7d9b0 to your computer and use it in GitHub Desktop.
Python script to add header file to all files in a library. (This may be the worst thing I've done in a while... But it got the build working!)
def appendWithImport(filename):
with open (filename, "r+") as file:
original = file.read()
file.seek(0,0)
file.write("@import Foundation; \n" + original)
files = [
"ZXingObjC-modified/aztec/decoder/ZXAztecDecoder.h",
"ZXingObjC-modified/aztec/detector/ZXAztecDetector.h",
"ZXingObjC-modified/aztec/encoder/ZXAztecBinaryShiftToken.h",
"ZXingObjC-modified/aztec/encoder/ZXAztecCode.h",
"ZXingObjC-modified/aztec/encoder/ZXAztecEncoder.h",
"ZXingObjC-modified/aztec/encoder/ZXAztecHighLevelEncoder.h",
"ZXingObjC-modified/aztec/encoder/ZXAztecSimpleToken.h",
"ZXingObjC-modified/aztec/encoder/ZXAztecState.h",
]
for filename in files:
appendWithImport(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment