mirror of
https://github.com/Adaptix-Framework/AdaptixC2
synced 2026-06-08 10:20:39 +00:00
Add Browser - ls
This commit is contained in:
@@ -16,6 +16,13 @@ QString ReadFileString(const QString &filePath, bool* result)
|
||||
return content;
|
||||
}
|
||||
|
||||
QString GetBasenameWindows(const QString& path)
|
||||
{
|
||||
QStringList pathParts = path.split("\\", Qt::SkipEmptyParts);
|
||||
return pathParts[pathParts.size()-1];
|
||||
}
|
||||
|
||||
|
||||
QString GetRootPathWindows(const QString& path)
|
||||
{
|
||||
if (path.startsWith("\\\\")) {
|
||||
@@ -31,4 +38,26 @@ QString GetRootPathWindows(const QString& path)
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
QString GetParentPathWindows(const QString& path)
|
||||
{
|
||||
if (path.length() == 2 && path[1] == ':')
|
||||
return path;
|
||||
|
||||
if (path.startsWith("\\\\") && !path.contains('\\'))
|
||||
return path;
|
||||
|
||||
QString parentPath = path;
|
||||
if (!parentPath.endsWith('\\'))
|
||||
parentPath += '\\';
|
||||
|
||||
int lastBackslashIndex = parentPath.lastIndexOf('\\');
|
||||
int secondLastBackslashIndex = parentPath.lastIndexOf('\\', lastBackslashIndex - 1);
|
||||
|
||||
if (secondLastBackslashIndex != -1) {
|
||||
return parentPath.left(secondLastBackslashIndex);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user