<commit_before>#include "steam_drm.h"
#include <libs/steam_vdf_parse.hpp>

SteamDRM::SteamDRM() : DRMType("<b>Steam</b>") {}
/** Check if Steam is installed on the current computer, if applicable, and sets some values for later pages to
 * check on.
 */
void SteamDRM::checkExists()
{
    QDir steamFolder;

#if defined(__linux__)
    QProcess which;
    which.setProcessChannelMode(QProcess::MergedChannels);
    QStringList args;
    args << "steam";
    which.start("which", args);
    which.waitForFinished();
    if (which.exitCode() == 0)
    {
        steamFolder = QDir::homePath() + "/.local/share/Steam";
    }
#elif defined(_WIN32) || defined(_WIN64)
    QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam", QSettings::NativeFormat);
    if (!settings.value("SteamPath").isNull())
    {
        steamFolder = QDir(settings.value("SteamPath").toString()).canonicalPath();
    }
#elif defined(__APPLE__)
    steamFolder = QDir(QDir::home().filePath("Library/Application Support/Steam"));
#endif

    if (steamFolder.filePath("").trimmed() != "" && steamFolder.exists() && steamFolder != QDir("."))
    {
        this->setRootDir(steamFolder);
        this->setIsInstalled();
        statusLabel->setPixmap(QPixmap(":/system_menu/icons/tick.svg"));
        descLabel = new QLabel("Steam found in " + steamFolder.filePath(""));
        QDir steamAppsDir = steamFolder.filePath("steamapps");
        if (!steamAppsDir.exists())
        {
            steamAppsDir = steamFolder.filePath("SteamApps");
        }
        pt::ptree libraryFolders;
        pt::read_info(steamAppsDir.filePath("libraryfolders.vdf").toLocal8Bit().constData(), libraryFolders);
        steamDirectoryList.append(steamFolder.filePath(""));
        QString pathString = "";

        for (auto& kv : libraryFolders.get_child("LibraryFolders"))
        {
            if (std::isdigit(static_cast<int>(*kv.first.data())))
            {
                std::string path = kv.second.data();
                QDir dir(QString::fromStdString(path));
                if (dir.exists())
                {
                    steamDirectoryList.append(dir.filePath(""));
                    pathString += dir.filePath("");
                    pathString += "\n";
                }
            }
        }
        if (steamDirectoryList.size() >= 2)
        {
            descLabel->setText(descLabel->text() + "\n\nLibrary folders:\n" + pathString);
        }
    }
    else
    {<commit_msg>Fix linux path issue<commit_after>#include "steam_drm.h"
#include <libs/steam_vdf_parse.hpp>

SteamDRM::SteamDRM() : DRMType("<b>Steam</b>") {}
/** Check if Steam is installed on the current computer, if applicable, and sets some values for later pages to
 * check on.
 */
void SteamDRM::checkExists()
{
    QDir steamFolder;

#if defined(__linux__)
    QProcess which;
    which.setProcessChannelMode(QProcess::MergedChannels);
    QStringList args;
    args << "steam";
    which.start("which", args);
    which.waitForFinished();
    if (which.exitCode() == 0)
    {
        steamFolder = QDir::homePath() + "/.local/share/Steam";
    }
#elif defined(_WIN32) || defined(_WIN64)
    QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam", QSettings::NativeFormat);
    if (!settings.value("SteamPath").isNull())
    {
        steamFolder = QDir(settings.value("SteamPath").toString()).canonicalPath();
    }
#elif defined(__APPLE__)
    steamFolder = QDir(QDir::home().filePath("Library/Application Support/Steam"));
#endif
    QDir steamAppsDir = steamFolder.filePath("steamapps");
    if (!steamAppsDir.exists())
    {
        steamAppsDir = steamFolder.filePath("SteamApps");
    }

    if (QDir(steamAppsDir.filePath("libraryFolders.vdf")).exists() && steamFolder.filePath("").trimmed() != "" && steamFolder.exists() && steamFolder != QDir("."))
    {
        this->setRootDir(steamFolder);
        this->setIsInstalled();
        statusLabel->setPixmap(QPixmap(":/system_menu/icons/tick.svg"));
        descLabel = new QLabel("Steam found in " + steamFolder.filePath(""));
        pt::ptree libraryFolders;
        pt::read_info(steamAppsDir.filePath("libraryfolders.vdf").toLocal8Bit().constData(), libraryFolders);
        steamDirectoryList.append(steamFolder.filePath(""));
        QString pathString = "";

        for (auto& kv : libraryFolders.get_child("LibraryFolders"))
        {
            if (std::isdigit(static_cast<int>(*kv.first.data())))
            {
                std::string path = kv.second.data();
                QDir dir(QString::fromStdString(path));
                if (dir.exists())
                {
                    steamDirectoryList.append(dir.filePath(""));
                    pathString += dir.filePath("");
                    pathString += "\n";
                }
            }
        }
        if (steamDirectoryList.size() >= 2)
        {
            descLabel->setText(descLabel->text() + "\n\nLibrary folders:\n" + pathString);
        }
    }
    else
    {
{'fraction_non_alphanumeric': 0.15568022440392706, 'fraction_numerical': 0.002805049088359046, 'mean_word_length': 2.706013363028953, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '731341', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1534, 'n_words': 242}