#include "FilePath.h"
FilePath::FilePath()
{
}
QString FilePath::GetExecuteFilePath()
{
return QCoreApplication::applicationDirPath();
}
QString FilePath::GetExecuteFullPath()
{
return qApp->applicationFilePath();
}
QString FilePath::GetCurrentFullPath()
{
return QDir::currentPath();
}
QString FilePath::GetUserDirPath()
{
return QDir::homePath();
}
QString FilePath::GetExecuteName()
{
QString strName = GetExecuteFullName();
if(strName == "")
return "";
if(!strName.contains(".exe",Qt::CaseInsensitive))
return "";
return strName.section(".",0,0);
}
QString FilePath::GetExecuteFullName()
{
QString strName = qApp->applicationFilePath();
int npos = strName.lastIndexOf("/");
if(npos == -1)
return "";
return strName.right(strName.size() - npos - 1);
}
QString FilePath::GetDestopPath()
{
return QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).join(";");
}
QString FilePath::GetDocumentPath()
{
return QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).join(";");
}
QString FilePath::GetFontsPath()
{
return QStandardPaths::standardLocations(QStandardPaths::FontsLocation).join(";");
}
QString FilePath::GetApplicationsLocationPath()
{
return QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).join(";");
}
QString FilePath::GetMusicPath()
{
return QStandardPaths::standardLocations(QStandardPaths::MusicLocation).join(";");
}
QString FilePath::GetMoviesPath()
{
return QStandardPaths::standardLocations(QStandardPaths::MoviesLocation).join(";");
}
QString FilePath::GetPicturesPath()
{
return QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).join(";");
}
QString FilePath::GetTempPath()
{
return QStandardPaths::standardLocations(QStandardPaths::TempLocation).join(";");
}
QString FilePath::GetHomePath()
{
return QStandardPaths::standardLocations(QStandardPaths::HomeLocation).join(";");
}
QString FilePath::GetDataPath()
{
return QStandardPaths::standardLocations(QStandardPaths::DataLocation).join(";");
}
QString FilePath::GetCachePath()
{
return QStandardPaths::standardLocations(QStandardPaths::CacheLocation).join(";");
}
QString FilePath::GetGenericDataPath()
{
return QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).join(";");
}
QString FilePath::GetRuntimePath()
{
return QStandardPaths::standardLocations(QStandardPaths::RuntimeLocation).join(";");
}
QString FilePath::GetConfigPath()
{
return QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).join(";");
}
QString FilePath::GetDownloadPath()
{
return QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).join(";");
}
QString FilePath::GetGenericCachePath()
{
return QStandardPaths::standardLocations(QStandardPaths::GenericCacheLocation).join(";");
}
QString FilePath::GetGenericConfigPath()
{
return QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation).join(";");
}
QString FilePath::GetDataSaveFile()
{
return QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).join(";");
}
QString FilePath::GetConfigSaveFile()
{
return QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation).join(";");
}
没有合适的资源?快使用搜索试试~ 我知道了~
Qt之各种路径获取(Qt5.12.2 MinGW 64-bit)
共30个文件
qm:21个
dll:4个
cpp:2个
需积分: 0 0 下载量 3 浏览量
2024-05-19
12:03:18
上传
评论
收藏 31.19MB RAR 举报
温馨提示
资源(包含源码和可执行程序)获取了如下路径: 1.程序所在目录 2.程序的完整名称 3.当前工作目录 4.用户目录路径 5.执行程序名称 6.执行程序全称 7.QStandardPaths标准路径
资源推荐
资源详情
资源评论
收起资源包目录
FilePath.rar (30个子文件)
FilePath
FilePath.pro 836B
exe
libgcc_s_seh-1.dll 73KB
translations
qt_lv.qm 150KB
qt_sk.qm 123KB
qt_cs.qm 171KB
qt_de.qm 196KB
qt_ja.qm 127KB
qt_fi.qm 176KB
qt_da.qm 170KB
qt_ko.qm 128KB
qt_fr.qm 162KB
qt_pl.qm 159KB
qt_ar.qm 156KB
qt_it.qm 157KB
qt_bg.qm 161KB
qt_gd.qm 185KB
qt_es.qm 161KB
qt_en.qm 23B
qt_uk.qm 155KB
qt_ca.qm 180KB
qt_hu.qm 157KB
qt_he.qm 135KB
qt_ru.qm 177KB
Qt5Cored.dll 162.58MB
libwinpthread-1.dll 51KB
libstdc++-6.dll 1.36MB
FilePath.exe 630KB
main.cpp 2KB
FilePath.cpp 3KB
FilePath.h 3KB
共 30 条
- 1
资源评论
wxl_shareInfo
- 粉丝: 130
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功