public static void separatePathAndFileName(String fullPath, ref String path, ref String fileName)
{
int pos = 0;
String sep = "";
pos = fullPath.Length;
if (pos == 0)
{
path = fullPath;
fileName = fullPath;
return;
}
sep = fullPath.Substring(pos, 1);
while (!isSeparator(sep))
{
pos = pos - 1;
if (pos == 0) { break; }
sep = fullPath.Substring(pos, 1);
}
if (pos == fullPath.Length-1)
{
// if the separator is founded at the end it must be a root folder example: c:\
//
path = fullPath.Substring(0, pos - 1);
fileName = fullPath;
}
else if (pos == 0)
{
// if the separator is not found it must be a root folder example: c:
//
path = fullPath;
fileName = fullPath;
}
else
{
path = fullPath.Substring(0, pos - 1);
fileName = fullPath.Substring(pos + 1);
}
}