Replace single-character string with character literal

Also remove unnecessary dynamic allocation.
This commit is contained in:
Chocobo1
2018-07-21 13:28:13 +08:00
committed by sledgehammer999
parent d088ab6f43
commit 9e99a0d3f5
32 changed files with 96 additions and 96 deletions

View File

@@ -734,16 +734,16 @@ void TorrentsController::setLocationAction()
{
checkParams({"hashes", "location"});
const QStringList hashes {params()["hashes"].split("|")};
const QStringList hashes {params()["hashes"].split('|')};
const QString newLocation {params()["location"].trimmed()};
if (newLocation.isEmpty())
throw APIError(APIErrorType::BadParams, tr("Save path is empty"));
// try to create the location if it does not exist
if (!QDir(newLocation).mkpath("."))
throw APIError(APIErrorType::Conflict, tr("Cannot make save path"));
// check permissions
if (!QFileInfo(newLocation).isWritable())
throw APIError(APIErrorType::AccessDenied, tr("Cannot write to directory"));