changed to 80 max column
This commit is contained in:
+19
-12
@@ -36,8 +36,9 @@ bool Paths::isPortable()
|
||||
void Paths::initAppFilePathHash()
|
||||
{
|
||||
this->applicationFilePathHash =
|
||||
QCryptographicHash::hash(QCoreApplication::applicationFilePath().toUtf8(),
|
||||
QCryptographicHash::Sha224)
|
||||
QCryptographicHash::hash(
|
||||
QCoreApplication::applicationFilePath().toUtf8(),
|
||||
QCryptographicHash::Sha224)
|
||||
.toBase64()
|
||||
.mid(0, 32)
|
||||
.replace("+", "-")
|
||||
@@ -46,15 +47,16 @@ void Paths::initAppFilePathHash()
|
||||
|
||||
void Paths::initCheckPortable()
|
||||
{
|
||||
this->portable_ =
|
||||
QFileInfo::exists(combinePath(QCoreApplication::applicationDirPath(), "portable"));
|
||||
this->portable_ = QFileInfo::exists(
|
||||
combinePath(QCoreApplication::applicationDirPath(), "portable"));
|
||||
}
|
||||
|
||||
void Paths::initAppDataDirectory()
|
||||
{
|
||||
assert(this->portable_.is_initialized());
|
||||
|
||||
// Root path = %APPDATA%/Chatterino or the folder that the executable resides in
|
||||
// Root path = %APPDATA%/Chatterino or the folder that the executable
|
||||
// resides in
|
||||
|
||||
this->rootAppDataDirectory = [&]() -> QString {
|
||||
// portable
|
||||
@@ -63,13 +65,15 @@ void Paths::initAppDataDirectory()
|
||||
}
|
||||
|
||||
// permanent installation
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
QString path =
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
if (path.isEmpty()) {
|
||||
throw std::runtime_error("Error finding writable location for settings");
|
||||
throw std::runtime_error(
|
||||
"Error finding writable location for settings");
|
||||
}
|
||||
|
||||
// create directory Chatterino2 instead of chatterino on windows because the ladder one is takes by
|
||||
// chatterino 1 already
|
||||
// create directory Chatterino2 instead of chatterino on windows because the
|
||||
// ladder one is takes by chatterino 1 already
|
||||
#ifdef Q_OS_WIN
|
||||
path.replace("chatterino", "Chatterino");
|
||||
|
||||
@@ -84,12 +88,15 @@ void Paths::initSubDirectories()
|
||||
// required the app data directory to be set first
|
||||
assert(!this->rootAppDataDirectory.isEmpty());
|
||||
|
||||
// create settings subdirectories and validate that they are created properly
|
||||
// create settings subdirectories and validate that they are created
|
||||
// properly
|
||||
auto makePath = [&](const std::string &name) -> QString {
|
||||
auto path = combinePath(this->rootAppDataDirectory, QString::fromStdString(name));
|
||||
auto path = combinePath(this->rootAppDataDirectory,
|
||||
QString::fromStdString(name));
|
||||
|
||||
if (!QDir().mkpath(path)) {
|
||||
throw std::runtime_error("Error creating appdata path %appdata%/chatterino/" + name);
|
||||
throw std::runtime_error(
|
||||
"Error creating appdata path %appdata%/chatterino/" + name);
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user