Qt 获取当前桌面 app路径 亦凉 2022-06-13 11:48 380阅读 0赞 桌面路径 QString desktop_path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); qDebug()<< "desktop_path:" << desktop_path; QStringList fileNames = QFileDialog::getOpenFileNames(this,tr("Select file"), desktop_path); qDebug()<< "fileNames:" << fileNames; QString fileName = fileNames.join(","); glb_in_put_file_path = fileName; qDebug()<< "glb_in_put_file_path:" << glb_in_put_file_path; -------------------- app路径 QString AppPath = QApplication::applicationFilePath(); //qDebug() << "AppPath:" << AppPath; QString openssl_path_dir = AppPath; openssl_path_dir = openssl_path_dir.replace(QString("cmd_openssl.exe"), QString("openssl/bin/")); //qDebug() << "openssl_path_dir:" << openssl_path_dir; QFileInfo fileInfo(AppPath); QString app_name = fileInfo.fileName(); qDebug() << "fileName--->:" << fileInfo.fileName(); qDebug() << "baseName--->:" <<fileInfo.baseName();
还没有评论,来说两句吧...