SimpleSpritePackerEditor.SPTools.IsDirectory C# (CSharp) Method

IsDirectory() public static method

Determines if the specified path is directory.
public static IsDirectory ( string path ) : bool
path string Path.
return bool
        public static bool IsDirectory(string path)
        {
            if (string.IsNullOrEmpty(path))
                return false;

            return System.IO.Directory.Exists(path);
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Filters the resources for atlas import.
        /// </summary>
        /// <returns>The resources for atlas import.</returns>
        /// <param name="resources">Resources.</param>
        public static Object[] FilterResourcesForAtlasImport(Object[] resources)
        {
            List <Object> tempList = new List <Object>();

            foreach (Object resource in resources)
            {
                string resourcePath = SPTools.GetAssetPath(resource);

                // Check if this is a main asset and queue all it's sub assets
                if (SPTools.IsMainAsset(resource) && SPTools.HasSubAssets(resource))
                {
                    Object[] subAssets = SPTools.FilterResourcesForAtlasImport(SPTools.GetSubAssets(resource));

                    foreach (Object a in subAssets)
                    {
                        tempList.Add(a);
                    }
                }
                else if (resource is Texture2D || resource is Sprite)
                {
                    tempList.Add(resource);
                }
                else if (SPTools.IsDirectory(resourcePath))
                {
                    Object[] subAssets = SPTools.FilterResourcesForAtlasImport(SPTools.GetDirectoryAssets(resourcePath));

                    foreach (Object a in subAssets)
                    {
                        tempList.Add(a);
                    }
                }
            }

            return(tempList.ToArray());
        }