Qt get the current desktop app path

desktop path

    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 path

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325883188&siteId=291194637