mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 22:47:21 -06:00
Rename "fromNativePath" to "toUniformPath"
Unlike "toNativePath" which name clearly reflects the function result "fromNativePath" has no such clear meaning. Since this function converts path into uniform format "toUniformPath" is better name.
This commit is contained in:
@@ -60,17 +60,12 @@
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/global.h"
|
||||
|
||||
/**
|
||||
* Converts a path to a string suitable for display.
|
||||
* This function makes sure the directory separator used is consistent
|
||||
* with the OS being run.
|
||||
*/
|
||||
QString Utils::Fs::toNativePath(const QString &path)
|
||||
{
|
||||
return QDir::toNativeSeparators(path);
|
||||
}
|
||||
|
||||
QString Utils::Fs::fromNativePath(const QString &path)
|
||||
QString Utils::Fs::toUniformPath(const QString &path)
|
||||
{
|
||||
return QDir::fromNativeSeparators(path);
|
||||
}
|
||||
@@ -87,7 +82,7 @@ QString Utils::Fs::fileExtension(const QString &filename)
|
||||
|
||||
QString Utils::Fs::fileName(const QString &filePath)
|
||||
{
|
||||
const QString path = fromNativePath(filePath);
|
||||
const QString path = toUniformPath(filePath);
|
||||
const int slashIndex = path.lastIndexOf('/');
|
||||
if (slashIndex == -1)
|
||||
return path;
|
||||
@@ -96,7 +91,7 @@ QString Utils::Fs::fileName(const QString &filePath)
|
||||
|
||||
QString Utils::Fs::folderName(const QString &filePath)
|
||||
{
|
||||
const QString path = fromNativePath(filePath);
|
||||
const QString path = toUniformPath(filePath);
|
||||
const int slashIndex = path.lastIndexOf('/');
|
||||
if (slashIndex == -1)
|
||||
return path;
|
||||
@@ -248,7 +243,7 @@ qint64 Utils::Fs::freeDiskSpaceOnPath(const QString &path)
|
||||
|
||||
QString Utils::Fs::branchPath(const QString &filePath, QString *removed)
|
||||
{
|
||||
QString ret = fromNativePath(filePath);
|
||||
QString ret = toUniformPath(filePath);
|
||||
if (ret.endsWith('/'))
|
||||
ret.chop(1);
|
||||
const int slashIndex = ret.lastIndexOf('/');
|
||||
|
||||
Reference in New Issue
Block a user