Skip to content

Commit

Permalink
Fix Install executable path acquisition
Browse files Browse the repository at this point in the history
Originally the path and name of the executable were being conflated,
even though they may not be the same.

This also changes LB to point to its actual main exe instead of its
launcher.
  • Loading branch information
oblivioncth committed Jul 23, 2023
1 parent 45ff14b commit 4a96b6e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/src/frontend/attractmode/am-install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ QString Install::translateDocName(const QString& originalName, Fe::DataDoc::Type
return translatedName;
}

QString Install::executableSubPath() const { return MAIN_EXE_PATH; }

QString Install::imageDestinationPath(Fp::ImageType imageType, const Fe::Game* game) const
{
return mFpScraperDirectory.absolutePath() + '/' +
Expand Down Expand Up @@ -305,7 +307,6 @@ void Install::softReset()
}

QString Install::name() const { return NAME; }
QString Install::executableName() const { return MAIN_EXE_PATH; }
QList<Fe::ImageMode> Install::preferredImageModeOrder() const { return IMAGE_MODE_ORDER; }

QString Install::versionString() const
Expand Down
4 changes: 3 additions & 1 deletion app/src/frontend/attractmode/am-install.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class Install : public Fe::Install
Qx::Error populateExistingDocs() override;
QString translateDocName(const QString& originalName, Fe::DataDoc::Type type) const override;

// Info
QString executableSubPath() const override;

// Image Processing
QString imageDestinationPath(Fp::ImageType imageType, const Fe::Game* game) const;

Expand All @@ -114,7 +117,6 @@ class Install : public Fe::Install

// Info
QString name() const override;
QString executableName() const override;
QList<Fe::ImageMode> preferredImageModeOrder() const override;
QString versionString() const override;

Expand Down
2 changes: 1 addition & 1 deletion app/src/frontend/fe-install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool Install::supportsImageMode(ImageMode imageMode) const { return preferredIma

QString Install::versionString() const
{
Qx::FileDetails exeDetails = Qx::FileDetails::readFileDetails(executableName());
Qx::FileDetails exeDetails = Qx::FileDetails::readFileDetails(executablePath());

QString fileVersionStr = exeDetails.stringTable().fileVersion;
QString productVersionStr = exeDetails.stringTable().productVersion;
Expand Down
4 changes: 3 additions & 1 deletion app/src/frontend/fe-install.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ class Install : public InstallFoundation
virtual std::shared_ptr<PlatformDoc::Writer> preparePlatformDocCommit(const std::unique_ptr<PlatformDoc>& document) = 0;
virtual std::shared_ptr<PlaylistDoc::Writer> preparePlaylistDocCommit(const std::unique_ptr<PlaylistDoc>& document) = 0;

// Info
virtual QString executableSubPath() const = 0;

public:
// Install management
virtual void softReset() override;

// Info
virtual QString name() const = 0;
virtual QString executableName() const = 0;
virtual QList<ImageMode> preferredImageModeOrder() const = 0;
bool supportsImageMode(ImageMode imageMode) const;
virtual QString versionString() const;
Expand Down
3 changes: 3 additions & 0 deletions app/src/frontend/fe-installfoundation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ QList<QString> InstallFoundation::modifiedPlaylists() const { return modifiedDat
bool InstallFoundation::isValid() const { return mValid; }
QString InstallFoundation::path() const { return mRootDirectory.absolutePath(); }

QString InstallFoundation::executableName() const { return QFileInfo(executableSubPath()).fileName(); }
QString InstallFoundation::executablePath() const { return mRootDirectory.absoluteFilePath(executableSubPath()); }

Qx::Error InstallFoundation::refreshExistingDocs(bool* changed)
{
QSet<DataDoc::Identifier> oldDocSet;
Expand Down
4 changes: 4 additions & 0 deletions app/src/frontend/fe-installfoundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class InstallFoundation
virtual void softReset();
void declareValid(bool valid);
virtual Qx::Error populateExistingDocs() = 0; // Stated redundantly again in Install to make it clear its part of the main interface
virtual QString executableSubPath() const = 0; // Stated redundantly again in Install to make it clear its part of the main interface

virtual QString translateDocName(const QString& originalName, DataDoc::Type type) const;
void catalogueExistingDoc(DataDoc::Identifier existingDoc);
Expand All @@ -156,6 +157,9 @@ class InstallFoundation
bool isValid() const;
QString path() const;

QString executableName() const;
QString executablePath() const;

Qx::Error refreshExistingDocs(bool* changed = nullptr);
bool containsPlatform(const QString& name) const;
bool containsPlaylist(const QString& name) const;
Expand Down
3 changes: 2 additions & 1 deletion app/src/frontend/launchbox/lb-install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ QString Install::translateDocName(const QString& originalName, Fe::DataDoc::Type
return translatedName;
}

QString Install::executableSubPath() const { return MAIN_EXE_PATH; }

QString Install::imageDestinationPath(Fp::ImageType imageType, const Fe::Game* game) const
{
return mPlatformImagesDirectory.absolutePath() + '/' +
Expand Down Expand Up @@ -300,7 +302,6 @@ void Install::softReset()
}

QString Install::name() const { return NAME; }
QString Install::executableName() const { return MAIN_EXE_PATH; }
QList<Fe::ImageMode> Install::preferredImageModeOrder() const { return IMAGE_MODE_ORDER; }

QString Install::versionString() const
Expand Down
6 changes: 4 additions & 2 deletions app/src/frontend/launchbox/lb-install.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Install : public Fe::Install
static inline const QString PLAYLISTS_PATH = u"Data/Playlists"_s;
static inline const QString DATA_PATH = u"Data"_s;
static inline const QString CORE_PATH = u"Core"_s;
static inline const QString MAIN_EXE_PATH = u"LaunchBox.exe"_s;
static inline const QString MAIN_EXE_PATH = u"Core/LaunchBox.exe"_s;
static inline const QString PLATFORM_IMAGES_PATH = u"Images"_s;
static inline const QString LOGO_PATH = u"Box - Front"_s;
static inline const QString SCREENSHOT_PATH = u"Screenshot - Gameplay"_s;
Expand Down Expand Up @@ -81,6 +81,9 @@ class Install : public Fe::Install
Qx::Error populateExistingDocs() override;
QString translateDocName(const QString& originalName, Fe::DataDoc::Type type) const override;

// Info
QString executableSubPath() const override;

// Image Processing
QString imageDestinationPath(Fp::ImageType imageType, const Fe::Game* game) const;
void editBulkImageReferences(const Fe::ImageSources& imageSources);
Expand All @@ -103,7 +106,6 @@ class Install : public Fe::Install

// Info
QString name() const override;
QString executableName() const override;
QList<Fe::ImageMode> preferredImageModeOrder() const override;
QString versionString() const override;

Expand Down

0 comments on commit 4a96b6e

Please sign in to comment.