public static string ParsePath(DestinationFolder destinationFolder, string customPath)
        {
            string path = "";

                        #if !UNITY_EDITOR && UNITY_ANDROID
            // path = AndroidUtils.GetExternalPictureDirectory() ;
            // path = AndroidUtils.GetExternalFilesDir() ;
            path = AndroidUtils.GetFirstAvailableMediaStorage() + "/" + customPath;
                        #elif !UNITY_EDITOR && UNITY_IOS
            path = Application.persistentDataPath + "/" + customPath;
                        #else
            if (destinationFolder == DestinationFolder.CUSTOM_FOLDER)
            {
                path = customPath;
            }
            else if (destinationFolder == DestinationFolder.PERSISTENT_DATA_PATH)
            {
                // #if UNITY_EDITOR || UNITY_STANDALONE
                // path = Application.persistentDataPath + "/" + customPath;
                // #elif UNITY_ANDROID
                //              path = AndroidUtils.GetFirstAvailableMediaStorage()  + "/" + customPath;
                // #else
                path = Application.persistentDataPath + "/" + customPath;
                // #endif
            }
            else if (destinationFolder == DestinationFolder.DATA_PATH)
            {
                path = Application.dataPath + "/" + customPath;
            }
            else if (destinationFolder == DestinationFolder.PICTURES_FOLDER)
            {
                                        #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WSA || UNITY_WSA_10_0
                path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) + "/" + customPath;
                // #elif UNITY_ANDROID
                //              path = AndroidUtils.GetExternalPictureDirectory()  + "/" + customPath;
                // #elif UNITY_IOS
                //              path = Application.persistentDataPath + "/" +customPath;
                                        #else
                path = Application.persistentDataPath + "/" + customPath;
                                        #endif
            }
                        #endif

            // Add a slash if not already at the end of the folder name
            if (path.Length > 0)
            {
                path = path.Replace("//", "/");
                if (path[path.Length - 1] != '/' && path[path.Length - 1] != '\\')
                {
                    path += "/";
                }
            }

            return(path);
        }
Пример #2
0
        public string GetPath()
        {
            string path = "";

            if (m_Config.m_DestinationFolder == ScreenshotConfig.DestinationFolder.CUSTOM_FOLDER)
            {
                path = m_Config.m_CustomRootedPath;
            }
            else if (m_Config.m_DestinationFolder == ScreenshotConfig.DestinationFolder.PERSISTENT_DATA_PATH)
            {
                                                                #if UNITY_EDITOR || UNITY_STANDALONE
                path = Application.persistentDataPath + "/" + m_Config.m_CustomRelativePath;
                                                                #elif UNITY_ANDROID
                path = AndroidUtils.GetFirstAvailableMediaStorage() + "/" + m_Config.m_CustomRelativePath;
                                                                #else
                path = Application.persistentDataPath + "/" + m_Config.m_CustomRelativePath;
                                                                #endif
            }
            else if (m_Config.m_DestinationFolder == ScreenshotConfig.DestinationFolder.DATA_PATH)
            {
                path = Application.dataPath + "/" + m_Config.m_CustomRelativePath;
            }
            else if (m_Config.m_DestinationFolder == ScreenshotConfig.DestinationFolder.PICTURES_FOLDER)
            {
                                                                #if UNITY_EDITOR || UNITY_STANDALONE
                path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) + "/" + m_Config.m_CustomRelativePath;
                                                                #elif UNITY_ANDROID
                path = AndroidUtils.GetExternalPictureDirectory() + "/" + m_Config.m_CustomRelativePath;
                                                                #elif UNITY_IOS
                path = Application.persistentDataPath + "/" + m_Config.m_CustomRelativePath;
                                                                #else
                path = Application.persistentDataPath + "/" + m_Config.m_CustomRelativePath;
                                                                #endif
            }
            // Add a slash if not already at the end of the folder name
            if (path.Length > 0)
            {
                path = path.Replace("//", "/");
                if (path [path.Length - 1] != '/' && path [path.Length - 1] != '\\')
                {
                    path += "/";
                }
            }

            return(path);
        }