Copies a resource file to the bundle/Resources directory, performing any necessary compilation on each resource.
(self, source, dest, convert_to_binary)
| 45 | return name_string.title().replace("-", "") |
| 46 | |
| 47 | def ExecCopyBundleResource(self, source, dest, convert_to_binary): |
| 48 | """Copies a resource file to the bundle/Resources directory, performing any |
| 49 | necessary compilation on each resource.""" |
| 50 | convert_to_binary = convert_to_binary == "True" |
| 51 | extension = os.path.splitext(source)[1].lower() |
| 52 | if os.path.isdir(source): |
| 53 | # Copy tree. |
| 54 | # TODO(thakis): This copies file attributes like mtime, while the |
| 55 | # single-file branch below doesn't. This should probably be changed to |
| 56 | # be consistent with the single-file branch. |
| 57 | if os.path.exists(dest): |
| 58 | shutil.rmtree(dest) |
| 59 | shutil.copytree(source, dest) |
| 60 | elif extension in {".xib", ".storyboard"}: |
| 61 | return self._CopyXIBFile(source, dest) |
| 62 | elif extension == ".strings" and not convert_to_binary: |
| 63 | self._CopyStringsFile(source, dest) |
| 64 | else: |
| 65 | if os.path.exists(dest): |
| 66 | os.unlink(dest) |
| 67 | shutil.copy(source, dest) |
| 68 | |
| 69 | if convert_to_binary and extension in {".plist", ".strings"}: |
| 70 | self._ConvertToBinary(dest) |
| 71 | |
| 72 | def _CopyXIBFile(self, source, dest): |
| 73 | """Compiles a XIB file with ibtool into a binary plist in the bundle.""" |
nothing calls this directly
no test coverage detected