add app library path
This commit is contained in:
parent
c8c0039854
commit
1fe9be9791
|
@ -71,7 +71,7 @@ void ExecutableRunner::run()
|
|||
pathAdded.append(dir);
|
||||
}
|
||||
}
|
||||
pathAdded.append(pSettings->dirs().app());
|
||||
pathAdded.append(pSettings->dirs().appDir());
|
||||
if (!path.isEmpty()) {
|
||||
path+= PATH_SEPARATOR + pathAdded.join(PATH_SEPARATOR);
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
|||
pathAdded.append(dir);
|
||||
}
|
||||
}
|
||||
pathAdded.append(pSettings->dirs().app());
|
||||
pathAdded.append(pSettings->dirs().appDir());
|
||||
if (!path.isEmpty()) {
|
||||
path+= PATH_SEPARATOR + pathAdded.join(PATH_SEPARATOR);
|
||||
} else {
|
||||
|
|
|
@ -3853,7 +3853,7 @@ void Editor::reformat()
|
|||
QByteArray content = text().toUtf8();
|
||||
QStringList args = pSettings->codeFormatter().getArguments();
|
||||
QByteArray newContent = runAndGetOutput("astyle.exe",
|
||||
pSettings->dirs().app(),
|
||||
pSettings->dirs().appDir(),
|
||||
args,
|
||||
content);
|
||||
int oldTopLine = topLine();
|
||||
|
|
|
@ -2018,7 +2018,7 @@ void MainWindow::updateTools()
|
|||
file.close();
|
||||
if (item->pauseAfterExit) {
|
||||
executeFile(
|
||||
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
|
||||
includeTrailingPathDelimiter(pSettings->dirs().appDir())+"ConsolePauser.exe",
|
||||
" 1 \""+localizePath(file.fileName())+"\" ",
|
||||
workDir, file.fileName());
|
||||
} else {
|
||||
|
@ -2031,7 +2031,7 @@ void MainWindow::updateTools()
|
|||
} else {
|
||||
if (item->pauseAfterExit) {
|
||||
executeFile(
|
||||
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
|
||||
includeTrailingPathDelimiter(pSettings->dirs().appDir())+"ConsolePauser.exe",
|
||||
" 1 \""+program+"\" "+params,
|
||||
workDir, "");
|
||||
} else {
|
||||
|
@ -2696,7 +2696,7 @@ void MainWindow::openShell(const QString &folder, const QString &shellCommand)
|
|||
pathAdded.append(dir);
|
||||
}
|
||||
}
|
||||
pathAdded.append(pSettings->dirs().app());
|
||||
pathAdded.append(pSettings->dirs().appDir());
|
||||
if (!path.isEmpty()) {
|
||||
path= pathAdded.join(PATH_SEPARATOR) + PATH_SEPARATOR + path;
|
||||
} else {
|
||||
|
@ -5574,7 +5574,7 @@ void MainWindow::on_actionMove_To_Other_View_triggered()
|
|||
void MainWindow::on_actionC_C_Reference_triggered()
|
||||
{
|
||||
if (pSettings->environment().language()=="zh_CN") {
|
||||
QFileInfo fileInfo(includeTrailingPathDelimiter(pSettings->dirs().app())+"cppreference-zh.chm");
|
||||
QFileInfo fileInfo(includeTrailingPathDelimiter(pSettings->dirs().appDir())+"cppreference-zh.chm");
|
||||
if (fileInfo.exists()) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
|
||||
} else {
|
||||
|
|
|
@ -151,14 +151,26 @@ Settings::Dirs::Dirs(Settings *settings):
|
|||
{
|
||||
}
|
||||
|
||||
QString Settings::Dirs::app() const
|
||||
QString Settings::Dirs::appDir() const
|
||||
{
|
||||
return QApplication::instance()->applicationDirPath();
|
||||
}
|
||||
|
||||
QString Settings::Dirs::appLibDir() const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return appDir();
|
||||
#elif defined(Q_OS_LINUX)
|
||||
if (isGreenEdition()) {
|
||||
return app();
|
||||
}
|
||||
return includeTrailingPathDelimiter(PREFIX)+"lib";
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Settings::Dirs::templateDir() const
|
||||
{
|
||||
return includeTrailingPathDelimiter(app()) + "templates";
|
||||
return includeTrailingPathDelimiter(appDir()) + "templates";
|
||||
}
|
||||
|
||||
QString Settings::Dirs::projectDir() const
|
||||
|
@ -169,7 +181,7 @@ QString Settings::Dirs::projectDir() const
|
|||
QString Settings::Dirs::data(Settings::Dirs::DataType dataType) const
|
||||
{
|
||||
using DataType = Settings::Dirs::DataType;
|
||||
QString dataDir = includeTrailingPathDelimiter(app())+"data";
|
||||
QString dataDir = includeTrailingPathDelimiter(appDir())+"data";
|
||||
switch (dataType) {
|
||||
case DataType::None:
|
||||
return dataDir;
|
||||
|
@ -209,7 +221,7 @@ void Settings::Dirs::doLoad()
|
|||
{
|
||||
QString defaultProjectDir;
|
||||
if (isGreenEdition()) {
|
||||
defaultProjectDir = includeTrailingPathDelimiter(app()) + "projects";
|
||||
defaultProjectDir = includeTrailingPathDelimiter(appDir()) + "projects";
|
||||
} else {
|
||||
defaultProjectDir = includeTrailingPathDelimiter(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0])
|
||||
+ "projects";
|
||||
|
@ -2468,8 +2480,8 @@ void Settings::CompilerSets::clearSets()
|
|||
void Settings::CompilerSets::findSets()
|
||||
{
|
||||
clearSets();
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().app())+"MinGW32"+QDir::separator()+"bin");
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().app())+"MinGW64"+QDir::separator()+"bin");
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin");
|
||||
addSets(includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+QDir::separator()+"bin");
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
QString path = env.value("PATH");
|
||||
|
@ -2551,8 +2563,8 @@ void Settings::CompilerSets::loadSets()
|
|||
QObject::tr("Compiler set not configuared.")
|
||||
+"<br /><br />"
|
||||
+QObject::tr("Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? ")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().app()) + "MinGW32")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().app()) + "MinGW64"),
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW32")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW64"),
|
||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
@ -2629,8 +2641,8 @@ Settings::PCompilerSet Settings::CompilerSets::getSet(int index)
|
|||
|
||||
void Settings::CompilerSets::savePath(const QString& name, const QString& path) {
|
||||
QString s;
|
||||
QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.app()) + "/";
|
||||
QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.app()) + QDir::separator();
|
||||
QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + "/";
|
||||
QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + QDir::separator();
|
||||
if (path.startsWith(prefix1, PATH_SENSITIVITY)) {
|
||||
s = "%AppPath%/"+ path.mid(prefix1.length());
|
||||
} else if (path.startsWith(prefix2, PATH_SENSITIVITY)) {
|
||||
|
@ -2645,8 +2657,8 @@ void Settings::CompilerSets::savePathList(const QString& name, const QStringList
|
|||
QStringList sl;
|
||||
for (const QString& path: pathList) {
|
||||
QString s;
|
||||
QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.app()) + "/";
|
||||
QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.app()) + QDir::separator();
|
||||
QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + "/";
|
||||
QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + QDir::separator();
|
||||
if (path.startsWith(prefix1, PATH_SENSITIVITY)) {
|
||||
s = "%AppPath%/"+ path.mid(prefix1.length());
|
||||
} else if (path.startsWith(prefix2, PATH_SENSITIVITY)) {
|
||||
|
@ -2706,7 +2718,7 @@ QString Settings::CompilerSets::loadPath(const QString &name)
|
|||
QString s = mSettings->mSettings.value(name).toString();
|
||||
QString prefix = "%AppPath%/";
|
||||
if (s.startsWith(prefix)) {
|
||||
s = includeTrailingPathDelimiter(mSettings->mDirs.app()) + s.mid(prefix.length());
|
||||
s = includeTrailingPathDelimiter(mSettings->mDirs.appDir()) + s.mid(prefix.length());
|
||||
}
|
||||
return QFileInfo(s).absoluteFilePath();
|
||||
}
|
||||
|
@ -2718,7 +2730,7 @@ void Settings::CompilerSets::loadPathList(const QString &name, QStringList& list
|
|||
QString prefix = "%AppPath%/";
|
||||
for (QString& s:sl) {
|
||||
if (s.startsWith(prefix)) {
|
||||
s = includeTrailingPathDelimiter(mSettings->mDirs.app()) + s.mid(prefix.length());
|
||||
s = includeTrailingPathDelimiter(mSettings->mDirs.appDir()) + s.mid(prefix.length());
|
||||
}
|
||||
list.append(QFileInfo(s).absoluteFilePath());
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@ public:
|
|||
ColorSheme
|
||||
};
|
||||
explicit Dirs(Settings * settings);
|
||||
QString app() const;
|
||||
QString appDir() const;
|
||||
QString appLibDir() const;
|
||||
QString templateDir() const;
|
||||
QString projectDir() const;
|
||||
QString data(DataType dataType = DataType::None) const;
|
||||
|
|
|
@ -221,8 +221,8 @@ void CompilerSetOptionWidget::on_btnFindCompilers_pressed()
|
|||
if (QMessageBox::warning(this,tr("Confirm"),
|
||||
tr("Red Panda C++ will clear current compiler list and search"
|
||||
" for compilers in the following locations:\n '%1'\n'%2'\nAre you really want to continue?")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().app()) + "MinGW32")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().app()) + "MinGW64"),
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW32")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW64"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok )
|
||||
return;
|
||||
pSettings->compilerSets().clearSets();
|
||||
|
|
|
@ -306,7 +306,7 @@ void FormatterGeneralWidget::updateDemo()
|
|||
updateCodeFormatter(formatter);
|
||||
|
||||
QByteArray newContent = runAndGetOutput("astyle.exe",
|
||||
pSettings->dirs().app(),
|
||||
pSettings->dirs().appDir(),
|
||||
formatter.getArguments(),
|
||||
content);
|
||||
ui->editDemo->lines()->setText(newContent);
|
||||
|
|
|
@ -113,7 +113,7 @@ void ProjectGeneralWidget::on_btnBrowse_clicked()
|
|||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Select icon file"),
|
||||
pSettings->dirs().app(),
|
||||
pSettings->dirs().appDir(),
|
||||
tr("Icon Files (*.ico)"));
|
||||
if (!fileName.isEmpty()) {
|
||||
mIconPath = fileName;
|
||||
|
|
|
@ -228,7 +228,7 @@ void ToolsGeneralWidget::on_btnBrowseProgram_clicked()
|
|||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Select program"),
|
||||
pSettings->dirs().app(),
|
||||
pSettings->dirs().appDir(),
|
||||
tr("Executable files (*.exe)"));
|
||||
if (!fileName.isEmpty() ) {
|
||||
ui->txtProgram->setText(fileName);
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
#ifndef PREFIX
|
||||
#define PREFIX "/usr/local"
|
||||
#endif
|
||||
|
||||
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
||||
#ifdef Q_OS_WIN
|
||||
#define GCC_PROGRAM "gcc.exe"
|
||||
|
|
|
@ -781,7 +781,7 @@ QString parseMacros(const QString &s)
|
|||
result.replace("<DEFAULT>", localizePath(QDir::currentPath()));
|
||||
result.replace("<DEVCPP>", localizePath(pSettings->dirs().executable()));
|
||||
result.replace("<DEVCPPVERSION>", DEVCPP_VERSION);
|
||||
result.replace("<EXECPATH>", localizePath(pSettings->dirs().app()));
|
||||
result.replace("<EXECPATH>", localizePath(pSettings->dirs().appDir()));
|
||||
QDate today = QDate::currentDate();
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
||||
|
|
Loading…
Reference in New Issue