Library.Net.Amoeba.DownloadManager.GetUniqueFilePath C# (CSharp) Method

GetUniqueFilePath() private static method

private static GetUniqueFilePath ( string path ) : string
path string
return string
        private static string GetUniqueFilePath(string path)
        {
            if (!File.Exists(path))
            {
                return path;
            }

            for (int index = 1; ; index++)
            {
                string text = string.Format(@"{0}\{1} ({2}){3}",
                    Path.GetDirectoryName(path),
                    Path.GetFileNameWithoutExtension(path),
                    index,
                    Path.GetExtension(path));

                if (!File.Exists(text))
                {
                    return text;
                }
            }
        }