mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
filenames and paths processing little fix
This commit is contained in:
parent
90d426e347
commit
7fe938a7ca
4
core.cpp
4
core.cpp
|
@ -811,7 +811,7 @@ void Core::checkConnection()
|
|||
|
||||
void Core::loadConfiguration()
|
||||
{
|
||||
QString path = Settings::getSettingsDirPath() + '/' + CONFIG_FILE_NAME;
|
||||
QString path = QDir(Settings::getSettingsDirPath()).filePath(CONFIG_FILE_NAME);
|
||||
|
||||
QFile configurationFile(path);
|
||||
|
||||
|
@ -862,7 +862,7 @@ void Core::saveConfiguration()
|
|||
return;
|
||||
}
|
||||
|
||||
path += '/' + CONFIG_FILE_NAME;
|
||||
path = directory.filePath(CONFIG_FILE_NAME);
|
||||
QSaveFile configurationFile(path);
|
||||
if (!configurationFile.open(QIODevice::WriteOnly)) {
|
||||
qCritical() << "File " << path << " cannot be opened";
|
||||
|
|
|
@ -55,7 +55,7 @@ void Settings::load()
|
|||
if (portableSettings.exists())
|
||||
makeToxPortable=true;
|
||||
|
||||
QString filePath = getSettingsDirPath() + '/' + FILENAME;
|
||||
QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME);
|
||||
|
||||
//if no settings file exist -- use the default one
|
||||
QFile file(filePath);
|
||||
|
@ -125,7 +125,7 @@ void Settings::load()
|
|||
|
||||
void Settings::save()
|
||||
{
|
||||
QString filePath = getSettingsDirPath() + '/' + FILENAME;
|
||||
QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME);
|
||||
save(filePath);
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ QString Settings::getSettingsDirPath()
|
|||
#ifdef Q_OS_WIN
|
||||
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
||||
#else
|
||||
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + '/' + "tox" + '/';
|
||||
return QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QDir::separator() + "tox");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ QIcon SmileyPack::getAsIcon(const QString &key)
|
|||
void SmileyPack::cacheSmiley(const QString &name)
|
||||
{
|
||||
QSize size(16, 16); // TODO: adapt to text size
|
||||
QString filename = path % '/' % name;
|
||||
QString filename = QDir(path).filePath(name);
|
||||
QImage img(filename);
|
||||
|
||||
if (!img.isNull())
|
||||
|
|
|
@ -278,7 +278,7 @@ void FileTransfertWidget::acceptRecvRequest()
|
|||
QString path;
|
||||
while (true)
|
||||
{
|
||||
path = QFileDialog::getSaveFileName(this,tr("Save a file","Title of the file saving dialog"),QDir::currentPath()+'/'+filename->text());
|
||||
path = QFileDialog::getSaveFileName(this, tr("Save a file","Title of the file saving dialog"), QDir::current().filePath(filename->text()));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user