Beispiel #1
0
TSTRING GetFileFromPath(CTSTRING &tsPath) {

  TSTRING::size_type r = tsPath.rfind(_T('\\'));

  if (TSTRING::npos != r) {

    return tsPath.substr(r + 1);
    
  } else if (TSTRING::npos != (r = tsPath.rfind(_T('/')))) {

    return tsPath.substr(r + 1);

  }

  return _T("");
}
Beispiel #2
0
TSTRING GetPathFromFile(CTSTRING &tsFile) {

  TSTRING::size_type r = tsFile.rfind(_T('\\'));

  if (TSTRING::npos != r) {

    return tsFile.substr(0, r + 1);

  } else if (TSTRING::npos != (r = tsFile.rfind(_T('/')))) {

    return tsFile.substr(0, r + 1);

  }

  return _T("");
}
Beispiel #3
0
void GetShortFileName(CTSTRING &tsFile, TSTRING &tsOut) {

  if (_T("") != tsFile) {

    TSTRING::size_type n = tsFile.rfind(_T('\\'));

    if (TSTRING::npos != n) {

      tsOut = tsFile.substr(n + 1);

    } else {

      tsOut = tsFile;

    }

  }

}
Beispiel #4
0
bool GetFileExtension(CTSTRING &tsFile, TSTRING &tsOut) {

bool r = false;

  if (_T("") != tsFile) {

    TSTRING::size_type n = tsFile.rfind(_T('.'));

    if (TSTRING::npos != n) {

      tsOut = tsFile.substr(n + 1);
      r     = true;

    }

  }


  return r;
}