stella icon indicating copy to clipboard operation
stella copied to clipboard

Configurable Help source

Open thrust26 opened this issue 2 years ago • 9 comments

Currently all help is provided from the web. It should be possible to configure Stella so that it uses the local help instead.

thrust26 avatar Dec 25 '22 08:12 thrust26

Maybe instead of using a web address, it can use the local path instead. The problem here is that it's different for every OS, so that's a complication.

sa666666 avatar Dec 25 '22 13:12 sa666666

Yes, but I suppose we know the defaults. And we can add a browser window which allows the user to correct the defaults.

thrust26 avatar Dec 25 '22 17:12 thrust26

We don't know it from within Stella. For Windows at least, the install path is set by the installer (InnoSetup), which is separate from Stella. Similarly in Linux, it's determined by the configure script. About the only one we know for certain programatically is macOS, since the files are part of the app bundle.

sa666666 avatar Dec 25 '22 17:12 sa666666

Would relative paths work?

thrust26 avatar Dec 25 '22 18:12 thrust26

Only if the user doesn't change where Stella is installed, since that happens at install-time, long after Stella has been compiled.

I ran into similar issues with HarmonyCart software, and where to install the arm directory and then have the app auto-magically find it. In that case, though, I was using Qt, and it helped with this somewhat. The logic to do this correctly and cross-platform isn't easy.

sa666666 avatar Dec 25 '22 18:12 sa666666

I mean, wouldn't Stella know where its executable is? Or at least the relative path to the docs?

thrust26 avatar Dec 25 '22 23:12 thrust26

Not easily in a cross-platform way. Here's the relevant code from the big 3 OS's:

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemUNIX::OSystemUNIX()
{
  // Hardcoded for now, since that's what the installer always uses
  // At some point, it would be better to query the OS directly

  myARMPath = "/usr/share/harmonycart/";
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemMACOS::OSystemMACOS()
{
  QDir dir = QDir(QCoreApplication::applicationDirPath());
  dir.cdUp();
  dir.cdUp();
  dir.cd("arm");
  myARMPath = dir.absolutePath();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystemWindows::OSystemWindows()
  : OSystem()
{
  QDir dir = QDir(QCoreApplication::applicationDirPath());
  dir.cd("arm");
  myARMPath = dir.absolutePath();
}

Windows and macOS are using Qt-specific code, and Linux doesn't even have access to that. I guess we could look at the Qt source and see how it's done there. But that still doesn't solve the problem for Linux.

sa666666 avatar Dec 26 '22 01:12 sa666666

We either find out or let the user navigate to the correct spot. I suppose he should know were the documentation is, no?

At least for Windows we seem to already have the code (baseinappdir). Though I have looked into the code yet.

Maybe SDL_GetBasePath will do for all? Were is the documentation put for Linux and MacOS? In Windows it is simply a subdirectory of the application directory.

thrust26 avatar Dec 26 '22 08:12 thrust26

I now remember that Windows is having problems passing parameters when opening a file. In our case it will then simply open the doc, but not navigate to the given context. The user can change this behavior by editing the registry, but I suppose that's not feasible here.

How are Linux and MacOS behaving here?

thrust26 avatar Dec 26 '22 09:12 thrust26