Skip to content

On UNIX platform, Poco::Path::getExtension() returns name of the hidden file if no extension is present.  #4005

@shailcompsit

Description

@shailcompsit

Poco version: 1.11.6

For file path "/home/shailcompsit/workspace/.classexe", Poco::Path::getExtension() returns the name of the file as "classexe" instead of empty string.

#include <iostream>
#include <string>

#include "Poco/Path.h"

int main()
{
    std::string exePath = "/home/shailcompsit/workspace/.classexe";
    Poco::Path path(exePath, Poco::Path::Style::PATH_UNIX);
    std::cout<<"basename: " <<path.getBaseName()<<std::endl;
    std::cout<<"extension: "<<path.getExtension()<<std::endl;
    return 0;
}

Actual Output:

basename:
extension: classexe

Expected Output:

basename: .classexe
extension:

Not just getExtension() returns name of the file, getBaseName() returns empty string.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions