Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Refactor check for file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Angel Quinones Garcia committed Dec 6, 2015
1 parent 3ebe55d commit e677bc6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Scripts/dyci-recompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def removeDynamicLibsFromDirectory(dir):
print 'Directory %s does not exists' % dir
return
for file in files:
if file.endswith(".dylib") or file.endswith("resource"):
if file.endswith(".dylib") or file.endswith("resource"):
path = dir + os.sep + file
if os.path.isdir(path):
continue
Expand Down Expand Up @@ -75,7 +75,7 @@ def copyResource(source, dyci):
else:
copytree(source, bundlePath + "/" + resource_directory + "/" + os.path.split(source)[1])
stdout.write("LD : File " + source + " was successfully copied to application -> " + bundlePath + "/" + resource_directory + "/" + os.path.split(source)[1])
else:
else:

# Non-Localizable Resouerces..
if not os.path.isdir(source):
Expand All @@ -94,7 +94,7 @@ def copyResource(source, dyci):

fileHandle.close()

return 0
return 0

#----------------------------------------------------------------------------------

Expand All @@ -114,20 +114,20 @@ def copyResource(source, dyci):
exit(1)

# In case of resources..
if filename[-4:] == ".png" or filename[-4:] == ".jpg" or filename[-5:] == ".jpeg" or filename[-8:] == ".strings":
if filename.endswith((".png", ".jpg", ".jpeg", ".strings")):
resultCode = copyResource(filename, DYCI_ROOT_DIR)
exit(resultCode)

#In case of xibs
if filename[-4:] == ".xib":
if filename[-4:] == ".xib":
xibFilename = os.path.splitext(filename)[0] + ".nib"
runAndFailOnError(["ibtool", "--compile", xibFilename, filename])
resultCode = copyResource(xibFilename, DYCI_ROOT_DIR)
os.system("rm -Rf %s" % xibFilename)
exit(resultCode)

#Storyboards also welcome
if filename[-11:] == ".storyboard":
if filename[-11:] == ".storyboard":
storyboardFileName = os.path.splitext(filename)[0] + ".storyboardc"
runAndFailOnError(["ibtool", "--compile", storyboardFileName, filename])
resultCode = copyResource(storyboardFileName, DYCI_ROOT_DIR)
Expand Down

0 comments on commit e677bc6

Please sign in to comment.