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

Scenarios list not loading on Linux #1133

Closed
jwrober opened this issue Jul 14, 2022 · 1 comment · Fixed by #1139
Closed

Scenarios list not loading on Linux #1133

jwrober opened this issue Jul 14, 2022 · 1 comment · Fixed by #1139
Labels
bug Something isn't working gui This issue requires changes to the user interface

Comments

@jwrober
Copy link
Collaborator

jwrober commented Jul 14, 2022

Describe the bug
From the start screen, when you click the button to load a scenario game, the list of scenarios is empty.

To Reproduce
Steps to reproduce the behavior:

  1. Start the client
  2. Click on start scenario game
  3. See error

Expected behavior
You should get a list of the scenarios installed.

Screenshots
This is the issue...
image

This is what I expect...
image

Platform and version (please complete the following information):

  • OS: Linux (Debian and Arch)
  • Freeciv21 version: 3.0-beta2
  • Ruleset/Longturn game (if applicable): N/A

Additional context
During discord conversation it seems that in utility/shared.cpp the freeciv_storage_dir() is looking for a writable location, but the out of box scenarios are not installed in a writable location when installed via the package.

@jwrober jwrober added bug Something isn't working gui This issue requires changes to the user interface labels Jul 14, 2022
@lmoureaux
Copy link
Contributor

During discord conversation it seems that in utility/shared.cpp the freeciv_storage_dir() is looking for a writable location, but the out of box scenarios are not installed in a writable location when installed via the package.

static QStringList default_scenario_path()
{
  return {QStringLiteral("."), QStringLiteral("data/scenarios"),
          freeciv_storage_dir()
              + QStringLiteral("/" DATASUBDIR "/scenarios"),
          freeciv_storage_dir() + QStringLiteral("/scenarios")};
}

QString freeciv_storage_dir()
{
  static QString storage_dir;
  if (storage_dir.isEmpty()) {
    // Make sure that all exe get the same directory.
    auto app_name = QCoreApplication::applicationName();
    QCoreApplication::setApplicationName("freeciv21");
    storage_dir =
        QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
    QCoreApplication::setApplicationName(app_name);

    qDebug() << _("Storage dir:") << storage_dir;
  }

  return storage_dir;
}

We should look in default_data_path instead, basically default_data_path() with /scenarios appended:

static QStringList default_data_path()
{
  // Make sure that all executables get the same directory.
  auto app_name = QCoreApplication::applicationName();
  QCoreApplication::setApplicationName("freeciv21");

  auto paths =
      QStringList{QStringLiteral("."), QStringLiteral("data"),
                  freeciv_storage_dir() + QStringLiteral("/" DATASUBDIR),
                  QStringLiteral(FREECIV_INSTALL_DATADIR)}
      + QStandardPaths::standardLocations(QStandardPaths::DataLocation);
  QCoreApplication::setApplicationName(app_name);
  return paths;
}

lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 16, 2022
After it is installed, Freeciv21 is supposed to find its default set of
scenarios independent from where it's started from. Use default_data_path() to
build a list of paths to search in.

Closes longturn#1133.
jwrober pushed a commit that referenced this issue Jul 16, 2022
After it is installed, Freeciv21 is supposed to find its default set of
scenarios independent from where it's started from. Use default_data_path() to
build a list of paths to search in.

Closes #1133.
psampathkumar pushed a commit to psampathkumar/freeciv21 that referenced this issue Aug 1, 2022
After it is installed, Freeciv21 is supposed to find its default set of
scenarios independent from where it's started from. Use default_data_path() to
build a list of paths to search in.

Closes longturn#1133.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gui This issue requires changes to the user interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants