logic: used wstring in FilePath constructor
* used wstring in FilePath constructor where easily possible * added FilePath concatenate method that accepts string parameter * implemented using only wstring in MessageStatus * used wstring in config
This commit is contained in:
@@ -46,7 +46,7 @@ void setupApp(int argc, char *argv[])
|
||||
{
|
||||
if (AppPath::getAppPath().empty())
|
||||
{
|
||||
AppPath::setAppPath(QCoreApplication::applicationDirPath().toStdString() + "/");
|
||||
AppPath::setAppPath(FilePath(QCoreApplication::applicationDirPath().toStdWString() + L"/"));
|
||||
}
|
||||
|
||||
std::string userdir(std::getenv("HOME"));
|
||||
@@ -67,8 +67,8 @@ void setupApp(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdString(ResourcePaths::getFallbackPath().str()), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdString(AppPath::getAppPath() + "/user/" ), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdWString(ResourcePaths::getFallbackPath().wstr()), userDataPath);
|
||||
utility::copyNewFilesFromDirectory(QString::fromStdWString(AppPath::getAppPath().concatenate(L"user/").wstr()), userDataPath);
|
||||
}
|
||||
|
||||
#endif // INCLUDES_DEFAULT_H
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
void setupPlatform(int argc, char *argv[])
|
||||
{
|
||||
UserPaths::setUserDataPath(FilePath("./user/"));
|
||||
UserPaths::setUserDataPath(FilePath(L"./user/"));
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
|
||||
@@ -58,7 +58,7 @@ void setupPlatform(int argc, char *argv[])
|
||||
// ----------------------------------------------------------------------------
|
||||
// Makes the mac bundle copy the user files to the Application Support folder
|
||||
QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
QString oldDataPath = QString::fromStdString(ResourcePaths::getFallbackPath().str());
|
||||
QString oldDataPath = QString::fromStdWString(ResourcePaths::getFallbackPath().wstr());
|
||||
|
||||
QDir dataDir(dataPath);
|
||||
if (!dataDir.exists())
|
||||
@@ -81,13 +81,13 @@ void setupPlatform(int argc, char *argv[])
|
||||
utility::copyNewFilesFromDirectory(oldDataPath, dataPath);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
UserPaths::setUserDataPath(FilePath(dataPath.toStdString() + "/"));
|
||||
UserPaths::setUserDataPath(FilePath(dataPath.toStdWString() + L"/"));
|
||||
}
|
||||
|
||||
void setupApp(int argc, char *argv[])
|
||||
{
|
||||
FilePath path(QDir::currentPath().toStdString());
|
||||
AppPath::setAppPath(path.getAbsolute().str() + "/");
|
||||
const FilePath path(QDir::currentPath().toStdWString() + L"/");
|
||||
AppPath::setAppPath(path.getAbsolute());
|
||||
}
|
||||
|
||||
#endif // INCLUDES_MAC_H
|
||||
|
||||
@@ -36,21 +36,20 @@ void setupApp(int argc, char *argv[])
|
||||
{
|
||||
appPath = appPath.substr(0, pos + 1);
|
||||
}
|
||||
AppPath::setAppPath(FilePath(appPath).str());
|
||||
}
|
||||
|
||||
{
|
||||
FilePath userDataPath(AppPath::getAppPath() + "user/");
|
||||
FilePath userDataPath = AppPath::getAppPath().concatenate(L"user/");
|
||||
if (!userDataPath.exists())
|
||||
{
|
||||
userDataPath = FilePath(std::string(std::getenv("APPDATA")) + "/../local/Coati Software/");
|
||||
if (utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64)
|
||||
{
|
||||
userDataPath.concatenate(FilePath("Sourcetrail 64-bit/"));
|
||||
userDataPath.concatenate(L"Sourcetrail 64-bit/");
|
||||
}
|
||||
else
|
||||
{
|
||||
userDataPath.concatenate(FilePath("Sourcetrail/"));
|
||||
userDataPath.concatenate(L"Sourcetrail/");
|
||||
}
|
||||
userDataPath.makeCanonical();
|
||||
}
|
||||
@@ -58,8 +57,8 @@ void setupApp(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// This "copyFile" method does nothing if the copy destination already exist
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(L"ApplicationSettings.xml"), UserPaths::getAppSettingsPath());
|
||||
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(L"window_settings.ini"), UserPaths::getWindowSettingsPath());
|
||||
}
|
||||
|
||||
#endif // INCLUDES_WINDOWS_H
|
||||
|
||||
Reference in New Issue
Block a user