CSKernelFile.cFile.getPathAndFileName C# (CSharp) Method

getPathAndFileName() public static method

public static getPathAndFileName ( string fullFileName, string &path, string &fileName ) : void
fullFileName string
path string
fileName string
return void
        public static void getPathAndFileName(string fullFileName,
                                              out string path,
                                              out string fileName)
        {
            int sepPos = 0;
            string sep = "";

            sepPos = fullFileName.Length;
            if (sepPos == 0)
            {
                path = "";
                fileName = "";
            }
            else
            {
                sepPos -= 1;
                sep = fullFileName.Substring(sepPos, 1);
                while (!isSeparator(sep))
                {
                    sepPos--;
                    if (sepPos < 0) break;
                    sep = fullFileName.Substring(sepPos, 1);
                }
                if (sepPos == fullFileName.Length - 1)
                {
                    // case when fullFileName is c:\ or d:\ etc.
                    path = fullFileName.Substring(0, sepPos);
                    fileName = fullFileName;
                }
                else if (sepPos < 0)
                {
                    // case when fullFileName is c: or d: etc.
                    path = fullFileName;
                    fileName = fullFileName;
                }
                else
                {
                    path = fullFileName.Substring(0, sepPos);
                    fileName = fullFileName.Substring(sepPos + 1);
                }
            }
        }