Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added get game file based on install location #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pieterbrandsen
Copy link

This should work correctly. Tested on:

  • Windows
  • Awaiting test on linux
  • No tester for mac!

@pieterbrandsen
Copy link
Author

Linux also tested, works

@tiennou
Copy link

tiennou commented Jan 19, 2024

macOS (on Apple Silicon) reports:

file:///$PATH/screeps/screeps-steamless-client/node_modules/steam-game-path/lib/esm/index.js:62
        throw new Error("Unsupported operating system");
              ^

Error: Unsupported operating system
    at getSteamPath (file:///$PATH/screeps/screeps-steamless-client/node_modules/steam-game-path/lib/esm/index.js:62:15)
    at getGamePath (file:///$PATH/screeps/screeps-steamless-client/node_modules/steam-game-path/lib/esm/index.js:89:23)
    at file:///$PATH/screeps/screeps-steamless-client/dist/index.js:50:23
    at file:///$PATH/screeps/screeps-steamless-client/dist/index.js:54:6
    at file:///$PATH/screeps/screeps-steamless-client/dist/index.js:60:2
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12)

@tiennou
Copy link

tiennou commented Jan 19, 2024

It works with some patching:

// steam-game-path/lib/esm/index.js, getSteamPath
if (process.platform === "darwin") {
    const steamPath = path.join(homedir(), "Library", "Application Support", "Steam")
    if (fs.existsSync(steamPath)) {
        return steamPath;
    }
    return null;
}
if (process.platform !== "win32") {
    throw new Error(`Unsupported operating system: ${process.platform}`);
}

And the Locate and read 'package.nw' step needs to use path.join() instead of smacking a '' win separator in there.

}();
const steam = getGamePath(464350);
if (!steam || !steam.game) return undefined;
return steam.game.path + "\\package.nw";
Copy link
Contributor

@Jomik Jomik Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. Mac (and Linux) uses forward slash. Let's just check process.platform or path.join?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants