Ejemplo n.º 1
0
void catFN(wchar_t *text, int& pos,
           const csWString& filename, const UINT cmd)
{
  const int len    = filename.length();
  const int tag    = filename.lastIndexOf(L'\\');
  const int tagPos = tag < 0  ?  0 : tag+1;

  if( cmd != Cmd_List  &&  tagPos > 0 ) {
    csStringNCpy(&text[pos], filename.c_str(), tagPos);
    pos += tagPos;
  }

  // QUESTION: What to do in case of missing '\\'?
  if( cmd == Cmd_ListWithPathTabular ) {
    text[pos++] = L'\t';
  }

  csStringNCpy(&text[pos], &filename[tagPos], len-tagPos);
  pos += len - tagPos;

  if( csIsDirectory(filename.c_str()) ) {
    text[pos++] = L'\\';
  }

  text[pos++] = L'\r';
  text[pos++] = L'\n';
}
Ejemplo n.º 2
0
int lenFN(const csWString& filename, const UINT cmd)
{
  int size = 0;

  const int len    = filename.length();
  const int tag    = filename.lastIndexOf(L'\\');
  const int tagPos = tag < 0 || cmd != Cmd_List  ?  0 : tag+1;

  size += len - tagPos;
  if( cmd == Cmd_ListWithPathTabular ) {
    size++; // separating '\t'
  }
  if( csIsDirectory(filename.c_str()) ) {
    size++; // trailing  '\\'
  }
  size += 2; // "\r\n"

  return size;
}