EndWithDirectorySeparatorChar() public static method

public static EndWithDirectorySeparatorChar ( string path ) : bool
path string
return bool
Exemplo n.º 1
0
        string[] GetFiles()
        {
            if (CurFiles == null || CurLogProfilerDir != LogProfilerDir)
            {
                CurLogProfilerDir = LogProfilerDir;

                var path  = Path.GetFullPath(CurLogProfilerDir);
                var files = Directory.GetFiles(path, "*.txt");

                CurFiles = new string[files.Length];

                var length = path.Length;
                if (!PathEx.EndWithDirectorySeparatorChar(path))
                {
                    length++;
                }

                for (var i = 0; i < files.Length; ++i)
                {
                    CurFiles[i] = files[i].Substring(length);
                }

                System.Array.Sort <string>(CurFiles, (s1, s2) => { return(s1.CompareTo(s2)); });

                if (CurFiles.Length == 0)
                {
                    CurFiles = null;
                }
            }
            return(CurFiles);
        }
Exemplo n.º 2
0
        public static Stream OpenRead(string sourceFileName)
        {
#if UNITY_ANDROID
            if (sourceFileName.StartsWith(Application.streamingAssetsPath))
            {
                var startIndex = Application.streamingAssetsPath.Length;
                if (!PathEx.EndWithDirectorySeparatorChar(Application.streamingAssetsPath))
                {
                    startIndex++;
                }

                sourceFileName = sourceFileName.Substring(startIndex);
                return(new AndroidAssetStream(sourceFileName));
            }
#endif
            return(File.OpenRead(sourceFileName));
        }