AssetBundleGraph.IntegratedGUIExporter.ValidateExportPath C# (CSharp) Method

ValidateExportPath() public static method

public static ValidateExportPath ( string currentExportFilePath, string combinedPath, System.Action NullOrEmpty, System.Action DoesNotExist ) : bool
currentExportFilePath string
combinedPath string
NullOrEmpty System.Action
DoesNotExist System.Action
return bool
        public static bool ValidateExportPath(string currentExportFilePath, string combinedPath, Action NullOrEmpty, Action DoesNotExist)
        {
            if (string.IsNullOrEmpty(currentExportFilePath)) {
                NullOrEmpty();
                return false;
            }
            if (!Directory.Exists(combinedPath)) {
                DoesNotExist();
                return false;
            }
            return true;
        }

Usage Example

Example #1
0
        private void DoInspectorExporterGUI(NodeGUI node)
        {
            if (node.exportTo == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Exporter: Export given files to output directory.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            node.currentPlatform = UpdateCurrentPlatform(node.currentPlatform);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                EditorGUILayout.LabelField("Export Path:");
                var newExportPath = EditorGUILayout.TextField(
                    SystemDataUtility.GetProjectName(),
                    SystemDataUtility.GetPlatformValue(
                        node.exportTo.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    );

                var exporterrNodePath = FileUtility.GetPathWithProjectPath(newExportPath);
                if (IntegratedGUIExporter.ValidateExportPath(
                        newExportPath,
                        exporterrNodePath,
                        () => {
                    // TODO Make text field bold
                },
                        () => {
                    using (new EditorGUILayout.HorizontalScope()) {
                        EditorGUILayout.LabelField(exporterrNodePath + " does not exist.");
                        if (GUILayout.Button("Create directory"))
                        {
                            Directory.CreateDirectory(exporterrNodePath);
                            node.Save();
                        }
                    }
                    EditorGUILayout.Space();

                    EditorGUILayout.LabelField("Available Directories:");
                    string[] dirs = Directory.GetDirectories(Path.GetDirectoryName(exporterrNodePath));
                    foreach (string s in dirs)
                    {
                        EditorGUILayout.LabelField(s);
                    }
                }
                        ))
                {
                    using (new EditorGUILayout.HorizontalScope()) {
                        GUILayout.FlexibleSpace();
                                                #if UNITY_EDITOR_OSX
                        string buttonName = "Reveal in Finder";
                                                #else
                        string buttonName = "Show in Explorer";
                                                #endif
                        if (GUILayout.Button(buttonName))
                        {
                            EditorUtility.RevealInFinder(exporterrNodePath);
                        }
                    }
                }


                if (newExportPath != SystemDataUtility.GetPlatformValue(
                        node.exportTo.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.exportTo.Add(SystemDataUtility.CreateKeyNameFromString(node.currentPlatform), newExportPath);
                    node.Save();
                }
            }

            UpdateDeleteSetting(node);
        }
All Usage Examples Of AssetBundleGraph.IntegratedGUIExporter::ValidateExportPath