示例#1
0
        void RefreshMapsForGroupChildren(string projectPath, string realPath, PBXSourceTree realPathTree, PBXGroupData parent)
        {
            var children = new List <string>(parent.children);

            foreach (string guid in children)
            {
                PBXFileReferenceData fileRef = fileRefs[guid];
                string        pPath;
                string        rPath;
                PBXSourceTree rTree;

                if (fileRef != null)
                {
                    pPath = PBXPath.Combine(projectPath, fileRef.name);
                    PBXPath.Combine(realPath, realPathTree, fileRef.path, fileRef.tree, out rPath, out rTree);

                    if (!m_ProjectPathToFileRefMap.ContainsKey(pPath))
                    {
                        m_ProjectPathToFileRefMap.Add(pPath, fileRef);
                    }
                    if (!m_FileRefGuidToProjectPathMap.ContainsKey(fileRef.guid))
                    {
                        m_FileRefGuidToProjectPathMap.Add(fileRef.guid, pPath);
                    }
                    if (!m_RealPathToFileRefMap[rTree].ContainsKey(rPath))
                    {
                        m_RealPathToFileRefMap[rTree].Add(rPath, fileRef);
                    }
                    if (!m_GuidToParentGroupMap.ContainsKey(guid))
                    {
                        m_GuidToParentGroupMap.Add(guid, parent);
                    }

                    continue;
                }

                PBXGroupData gr = groups[guid];
                if (gr != null)
                {
                    pPath = PBXPath.Combine(projectPath, gr.name);
                    PBXPath.Combine(realPath, realPathTree, gr.path, gr.tree, out rPath, out rTree);

                    if (!m_ProjectPathToGroupMap.ContainsKey(pPath))
                    {
                        m_ProjectPathToGroupMap.Add(pPath, gr);
                    }
                    if (!m_GroupGuidToProjectPathMap.ContainsKey(gr.guid))
                    {
                        m_GroupGuidToProjectPathMap.Add(gr.guid, pPath);
                    }
                    if (!m_GuidToParentGroupMap.ContainsKey(guid))
                    {
                        m_GuidToParentGroupMap.Add(guid, parent);
                    }

                    RefreshMapsForGroupChildren(pPath, rPath, rTree, gr);
                }
            }
        }
示例#2
0
 // Write the actual file to the disk.
 // If you don't call this method nothing will change.
 public void WriteToFile()
 {
     File.WriteAllText(m_PBXProjectPath, project.WriteToString());
     if (m_Entitlements != null)
     {
         m_Entitlements.WriteToFile(PBXPath.Combine(m_BuildPath, m_EntitlementFilePath));
     }
     if (m_InfoPlist != null)
     {
         m_InfoPlist.WriteToFile(PBXPath.Combine(m_BuildPath, "Info.plist"));
     }
 }
示例#3
0
        // Creates a directory structure with "provides namespace" attribute.
        // First, retrieves or creates the directory at relativeBasePath, creating parent
        // directories if needed. Effectively calls OpenFolder(relativeBasePath).
        // Then, relative to this directory, creates namespacePath directories with "provides
        // namespace" attribute set. Fails if the attribute can't be set.
        public AssetFolder OpenNamespacedFolder(string relativeBasePath, string namespacePath)
        {
            var folder    = OpenFolder(relativeBasePath);
            var pathItems = PBXPath.Split(namespacePath);

            foreach (var pathItem in pathItems)
            {
                folder = folder.OpenFolder(pathItem);
                folder.providesNamespace = true;
            }
            return(folder);
        }
示例#4
0
        AssetFolder OpenFolderForResource(string relativePath)
        {
            var pathItems = PBXPath.Split(relativePath).ToList();

            // remove path filename
            pathItems.RemoveAt(pathItems.Count - 1);

            AssetFolder folder = root;

            foreach (var pathItem in pathItems)
            {
                folder = folder.OpenFolder(pathItem);
            }
            return(folder);
        }
示例#5
0
        // Checks if a folder with given path exists and returns it if it does.
        // Otherwise, creates a new folder. Parent folders are created if needed.
        public AssetFolder OpenFolder(string relativePath)
        {
            if (relativePath == null)
            {
                return(root);
            }
            var pathItems = PBXPath.Split(relativePath);

            if (pathItems.Length == 0)
            {
                return(root);
            }
            AssetFolder folder = root;

            foreach (var pathItem in pathItems)
            {
                folder = folder.OpenFolder(pathItem);
            }
            return(folder);
        }