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);
}
}
}