static void CreateFolderSymLink() { DirectoryEntry selectedFolder = EditorIO.OpenFolderPanelV2("Select a folder to link into Assets"); var targetFolder = EditorIO.GetAssetsFolder(); try { targetFolder = EditorIO.GetFolderOfCurrentSelectedObject(); } catch (System.Exception) { } targetFolder = targetFolder.GetChildDir(selectedFolder.Name); SymLinker.CreateSymlink(selectedFolder, targetFolder); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); }
public static bool AddToProjectViaPackageManager(string packageName, string packageVersion) { var manifestFile = EditorIO.GetProjectFolder().GetChildDir("Packages").GetChild("manifest.json"); if (manifestFile.IsNotNullAndExists()) { var manifest = manifestFile.LoadAs <Dictionary <string, object> >(); JObject dependencies = (manifest["dependencies"] as JObject); if (dependencies != null) { if (dependencies.TryGetValue(packageName, out JToken foundVersion)) { if (packageVersion.Equals(foundVersion.ToObject <string>())) { // Log.d("Package " + packageName + " already contained in Packages/manifest.json"); return(true); } else { Log.w("Package " + packageName + ":" + packageVersion + " not added, found exist. version in manifest.json: " + foundVersion); } } else { var s = JsonSerializer.Create(JsonNetSettings.defaultSettings); dependencies.Add(packageName, JToken.FromObject(packageVersion, s)); manifestFile.SaveAsText(JsonWriter.AsPrettyString(manifest)); return(true); } } else { Log.e("Dependencies list not found in manifest.json"); } } else { Log.e("Manifest.json file not found at " + manifestFile); } return(false); }
static void CreateDefaultGitIgnoreFiles() { var projectFolder = EditorIO.GetProjectFolder(); var assetsFolder = EditorIO.GetAssetsFolder(); if (!assetsFolder.Exists) { throw Log.e("Not the project folder: " + projectFolder); } var file = projectFolder.GetChild(".gitignore"); if (!file.Exists) { EditorCoroutineRunner.StartCoroutine(DownloadDefaultUnityGitIgnore(file)); } else { Log.d("No need to download .gitignore, was already found: " + file); } GitIgnoreUdater.AddAllSymlinksToGitIgnores(assetsFolder); AssetFolderAnalysis.FindFolderAnomalies(assetsFolder); }
static void DidReloadScripts() { LogAllEmptyFoldersIn(EditorIO.GetAssetsFolder()); }