getFileNameWithoutExtension identical works


Sorry, for insignificant question.
It’s question like “What was first - egg or hen?” but

const String File::getFileNameWithoutExtension() const throw()
    const int lastSlash = fullPath.lastIndexOfChar (separator) + 1;
    const int lastDot = fullPath.lastIndexOfChar (T('.'));

    if (lastDot > lastSlash)
        return fullPath.substring (lastSlash, lastDot);
        return fullPath.substring (lastSlash);

works identical for folders and for files.
You could tell that I should check is it folder or file and change behavior of my program. I do this now. But maybe…
Any thinks?


Sorry - don’t understand the question…! It just removes the bit of the filename that’s after the dot. Why would it matter whether it’s a directory?


I’ll try to improve my English.
Thanks for replying.