repo: 引入简易的 PathUtils

This commit is contained in:
zinface 2023-12-19 19:16:42 +08:00
parent f7277e6660
commit 06b4549140
3 changed files with 29 additions and 0 deletions

View File

@ -15,6 +15,7 @@ if(TRUE)
spark_add_executable_path(${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/cceditor
${PROJECT_SOURCE_DIR}/src/utils
${QRC_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE

15
src/utils/pathutil.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "pathutil.h"
#include <QApplication>
#include <QDir>
QString PathUtil::execDir()
{
QString path = qApp->applicationDirPath();
return path + QDir::separator();
}
QString PathUtil::pluginDir() {
QString path = execDir() + "plugin";
return path + QDir::separator();
}

13
src/utils/pathutil.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef PATHUTIL_H
#define PATHUTIL_H
#include <QString>
class PathUtil
{
public:
static QString execDir();
static QString pluginDir();
};
#endif // PATHUTIL_H