Giter Club home page Giter Club logo

Comments (4)

elken avatar elken commented on August 21, 2024

As noted here, the client has no need for anything a platform offers other than its existence on the system & where games are located, so an API would be a waste.

And as mentioned in various places, we're already looking into plugins.

from client.

lolzballs avatar lolzballs commented on August 21, 2024

Another thing to add, we will be implementing various features into plugins when a plugin API is created, including the game finding code. We don't want to waste resources creating it when we will be replacing it in the future.

from client.

Holzhaus avatar Holzhaus commented on August 21, 2024

As noted here, the client has no need for anything a platform offers other than its
existence on the system & where games are located, so an API would be a waste.

Then this (internal!) API just consists of two functions, getRoot() and findGames(). Maybe API is a misleading term for this - I meant that you should put the distribution-platform-specific code into seperate files.

Another thing to add, we will be implementing various features into plugins when a plugin API is created, including the game finding code. We don't want to waste resources creating it when we will be replacing it in the future.

I wasn't referring to implementing a fully featured plugin API for this - but seperating code for the different platforms from start could make it easier if you ever decide to implement them as plugins. It's just a simple copy&paste operation into separate files. findOriginGames() and findSteamGames() are even seperate functions now, but IMHO it's better to put them into dedicated files. It already becomes hard to read now, even though Uplay, GOG and others are still missing.

Anyway, just my 2 cents.

PS: Here's an example:

// Origin.cpp
bool originGetRoot(void)
{
    QDir originRoot(qgetenv("APPDATA").append("/Origin"));
    if (originRoot.exists())
    {
          return originRoot;
    }
    return NULL;
}
void originFindGames(void)
{
    /* Don't know about this function signature, could also
       take "QDir root" as argument instead  */
    QDir root = originGetRoot();
    if (root != NULL) {
        //insert code here
    }
}

// Steam.cpp
bool steamGetRoot(void)
{
    bool steamFound = false;
    QDir steamRoot;
    steamRoot.setPath("");
    #if defined(_WIN32) || defined(_WIN64)
        QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam",
                           QSettings::NativeFormat);
        QString steamPath = settings.value("SteamPath").toString();
        steamRoot = QDir(steamPath);
        steamFound = steamRoot != QDir::currentPath();
    #elif defined(__APPLE__)
        // TODO: however OS X handles steam
    #elif defined(__linux__)
        steamRoot = QDir(QDir::home().filePath(".steam/steam"));
        steamFound = true;
    #else
        // TODO?
    #endif
    if (steamFound && steamRoot.exists())
    {
        return steamRoot;
    }
    // Steam was not found, probably not installed.
    return NULL:
}
void SteamFindGames(void) {
      //insert code here
}

from client.

lolzballs avatar lolzballs commented on August 21, 2024

This was mentioned before internally, however we decided that, because only the Library will need to call these functions, they belong to the Library class. Creating entire files/classes(2 files each if you do the standard practice) dedicated to 2 functions that don't need to be separated and are going to be refactored out isn't the best way of decreasing code complexity. If you use an editor with a navigate to symbol button of some sort, the "messiness" of the code is more of a non-issue.

from client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.