初步统一了多航线采集和打开影像功能
This commit is contained in:
@ -112,6 +112,24 @@ std::string removeFileExtension(std::string filename)
|
||||
|
||||
}
|
||||
|
||||
// 从绝对路径中提取文件名(不包含扩展名)
|
||||
std::string getFileNameFromPath(const std::string &fullPath)
|
||||
{
|
||||
// 找到最后一个路径分隔符,支持 '/' 和 '\\'
|
||||
size_t lastSlash = fullPath.find_last_of("/\\");
|
||||
size_t start = (lastSlash == std::string::npos) ? 0 : lastSlash + 1;
|
||||
|
||||
// 找到最后一个点,确保点在文件名范围内
|
||||
size_t lastDot = fullPath.find_last_of('.');
|
||||
if (lastDot == std::string::npos || lastDot < start) {
|
||||
// 没有扩展名或点在路径之前,直接返回从 start 到结尾的子串
|
||||
return fullPath.substr(start);
|
||||
}
|
||||
|
||||
// 返回从 start 到 lastDot 之间的文件名(不含扩展名)
|
||||
return fullPath.substr(start, lastDot - start);
|
||||
}
|
||||
|
||||
QList<QString> getFileInfo(QString file)
|
||||
{
|
||||
QFileInfo fileInfo = QFileInfo(file);
|
||||
|
||||
Reference in New Issue
Block a user