| 1544 | _encode_transforms = XCFileLikeElement._alternate_encode_transforms |
| 1545 | |
| 1546 | def __init__(self, properties=None, id=None, parent=None): |
| 1547 | # super |
| 1548 | XCFileLikeElement.__init__(self, properties, id, parent) |
| 1549 | if "path" in self._properties and self._properties["path"].endswith("/"): |
| 1550 | self._properties["path"] = self._properties["path"][:-1] |
| 1551 | is_dir = True |
| 1552 | else: |
| 1553 | is_dir = False |
| 1554 | |
| 1555 | if ( |
| 1556 | "path" in self._properties |
| 1557 | and "lastKnownFileType" not in self._properties |
| 1558 | and "explicitFileType" not in self._properties |
| 1559 | ): |
| 1560 | # TODO(mark): This is the replacement for a replacement for a quick hack. |
| 1561 | # It is no longer incredibly sucky, but this list needs to be extended. |
| 1562 | extension_map = { |
| 1563 | "a": "archive.ar", |
| 1564 | "app": "wrapper.application", |
| 1565 | "bdic": "file", |
| 1566 | "bundle": "wrapper.cfbundle", |
| 1567 | "c": "sourcecode.c.c", |
| 1568 | "cc": "sourcecode.cpp.cpp", |
| 1569 | "cpp": "sourcecode.cpp.cpp", |
| 1570 | "css": "text.css", |
| 1571 | "cxx": "sourcecode.cpp.cpp", |
| 1572 | "dart": "sourcecode", |
| 1573 | "dylib": "compiled.mach-o.dylib", |
| 1574 | "framework": "wrapper.framework", |
| 1575 | "gyp": "sourcecode", |
| 1576 | "gypi": "sourcecode", |
| 1577 | "h": "sourcecode.c.h", |
| 1578 | "hxx": "sourcecode.cpp.h", |
| 1579 | "icns": "image.icns", |
| 1580 | "java": "sourcecode.java", |
| 1581 | "js": "sourcecode.javascript", |
| 1582 | "kext": "wrapper.kext", |
| 1583 | "m": "sourcecode.c.objc", |
| 1584 | "mm": "sourcecode.cpp.objcpp", |
| 1585 | "nib": "wrapper.nib", |
| 1586 | "o": "compiled.mach-o.objfile", |
| 1587 | "pdf": "image.pdf", |
| 1588 | "pl": "text.script.perl", |
| 1589 | "plist": "text.plist.xml", |
| 1590 | "pm": "text.script.perl", |
| 1591 | "png": "image.png", |
| 1592 | "py": "text.script.python", |
| 1593 | "r": "sourcecode.rez", |
| 1594 | "rez": "sourcecode.rez", |
| 1595 | "s": "sourcecode.asm", |
| 1596 | "storyboard": "file.storyboard", |
| 1597 | "strings": "text.plist.strings", |
| 1598 | "swift": "sourcecode.swift", |
| 1599 | "ttf": "file", |
| 1600 | "xcassets": "folder.assetcatalog", |
| 1601 | "xcconfig": "text.xcconfig", |
| 1602 | "xcdatamodel": "wrapper.xcdatamodel", |
| 1603 | "xcdatamodeld": "wrapper.xcdatamodeld", |