Beispiel #1
0
stdStr Path::fileSpec(const stdStr &path, const stdStr &name)
{
  stdStr fs;
  size_t len = path.size();
  if(path[len-1] == '/' || path[len-1] == '\\')
    fs = path + name;
  else
  {
    if(path.find(TEXT("/")) < path.size())
      fs = path + TEXT("/") + name;
    else if(path.find(TEXT("\\")) < path.size())
      fs = path + TEXT("\\") + name;
  }
  return fs;
}
Beispiel #2
0
stdStr Path::getPath(const stdStr &fileSpec)
{
  size_t pos = fileSpec.find_last_of(TEXT("/"));
  if(pos >= fileSpec.length())
    pos = fileSpec.find_last_of(TEXT("\\"));
  if(pos >= fileSpec.length())
    return TEXT(".");
  if(fileSpec.find(TEXT("."),pos+1))
    return toLower(fileSpec.substr(0,pos+1));
  return fileSpec;
}