Qt 获取当前桌面 app路径

桌面路径

    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();

猜你喜欢

转载自blog.csdn.net/linbounconstraint/article/details/74531592
今日推荐