mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07: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:
parent
206bb018dd
commit
8e65317d61
17 changed files with 54 additions and 47 deletions
|
@ -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('/');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue