Beispiel #1
0
 static void CheckJunction(DirectoryInfo dir, List <DirectoryInfo> badDirectories, List <string> brokenJunctions)
 {
     if (JunctionPoint.Exists(dir.FullName))
     {
         if (!Directory.Exists(JunctionPoint.GetTarget(dir.FullName)))
         {
             brokenJunctions.Add(dir.FullName);
         }
     }
     else
     {
         badDirectories.Add(dir);
     }
 }
Beispiel #2
0
        static void VerifyThatAllDirectoriesAreValidJunctions()
        {
            var badDirectories  = new List <DirectoryInfo>();
            var brokenJunctions = new List <string>();

            foreach (var scriptDir in new DirectoryInfo(Application.dataPath).GetDirectories())
            {
                if (scriptDir.Name == "Plugins")
                {
                    foreach (var pluginDir in scriptDir.GetDirectories())
                    {
                        if (pluginDir.Name == "Projeny")
                        {
                            continue;
                        }

                        if (JunctionPoint.Exists(pluginDir.FullName))
                        {
                            if (!Directory.Exists(JunctionPoint.GetTarget(pluginDir.FullName)))
                            {
                                brokenJunctions.Add(pluginDir.FullName);
                            }
                        }
                        else
                        {
                            badDirectories.Add(pluginDir);
                        }
                    }

                    continue;
                }

                if (JunctionPoint.Exists(scriptDir.FullName))
                {
                    if (!Directory.Exists(JunctionPoint.GetTarget(scriptDir.FullName)))
                    {
                        brokenJunctions.Add(scriptDir.FullName);
                    }
                }
                else
                {
                    badDirectories.Add(scriptDir);
                }
            }

            if (badDirectories.Any())
            {
                var badDirectoriesStr = string.Join("\n", badDirectories.Select(x => "Assets/" + x.FullName.Substring(Application.dataPath.Length + 1)).ToArray());

                EditorUtility.DisplayDialog(
                    "Projeny Error", "Projeny validation failed.\n\nThere are directories in your project that were not created by Projeny.  This could cause data loss.  All user data in Projeny should reside in the UnityPackages directory.  See documentation for details.  \n\nThe directories in question are the following: \n\n{0}".Fmt(badDirectoriesStr), "Ok");
            }

            if (brokenJunctions.Any())
            {
                var brokenJunctionsStr = string.Join("\n", brokenJunctions.Select(x => "Assets/" + x.Substring(Application.dataPath.Length + 1)).ToArray());

                EditorUtility.DisplayDialog(
                    "Projeny Error", "Projeny validation failed.\n\nThere are broken directory links in your project.  You may have deleted a package without removing the package from the project.  You can fix this by entering package manager and removing the missing packages from your project. See documentation for details.  \n\nThe directories in question are the following: \n\n{0}".Fmt(brokenJunctionsStr), "Ok");
            }
        }