Skip to content

Commit 9a39cc1

Browse files
committed
Add portable mode, update version
1 parent 0132e92 commit 9a39cc1

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

.github/workflows/build-win64-x86.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ jobs:
6565

6666
- name: Build zip
6767
working-directory: build
68-
run: cpack -G ZIP && mv Firelight-0.9.7-win64.zip Firelight-0.9.7-win64-portable.zip
68+
run: cpack -G ZIP && mv Firelight-0.9.8-win64.zip Firelight-0.9.8-win64-portable.zip
6969

7070
- name: Build installer
7171
working-directory: build
72-
run: cpack -G NSIS && mv Firelight-0.9.7-win64.exe Firelight-0.9.7-win64-installer.exe
72+
run: cpack -G NSIS && mv Firelight-0.9.8-win64.exe Firelight-0.9.8-win64-installer.exe
7373

74-
# - name: Upload artifact
75-
# uses: actions/upload-artifact@v4
76-
# with:
77-
# name: Firelight-0.9.7-win64-portable
78-
# path: build/Firelight-0.9.7-win64-portable.zip
74+
- name: Upload portable zip artifact
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: Firelight-0.9.8-win64-portable
78+
path: build/Firelight-0.9.8-win64-portable.zip
7979

80-
- name: Upload artifact
80+
- name: Upload installer artifact
8181
uses: actions/upload-artifact@v4
8282
with:
83-
name: Firelight-0.9.7-win64-installer
84-
path: build/Firelight-0.9.7-win64-installer.exe
83+
name: Firelight-0.9.8-win64-installer
84+
path: build/Firelight-0.9.8-win64-installer.exe
8585

8686
# - name: Prepare artifact
8787
# run: |

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.23.5...3.31.6)
22
project(firelight
3-
VERSION 0.9.7
3+
VERSION 0.9.8
44
DESCRIPTION "A libretro-based emulation frontend that aims to be the easiest way to play your retro games, discover awesome mods for those games, and just have a dang good time."
55
# HOMEPAGE_URL ""
66
LANGUAGES CXX
@@ -393,7 +393,7 @@ set(CPACK_PACKAGE_VENDOR "BiscuitCakes")
393393
set(CPACK_PACKAGE_VERSION_MAJOR 0)
394394
set(CPACK_PACKAGE_VERSION_MINOR 9)
395395
set(CPACK_PACKAGE_VERSION_PATCH 5)
396-
set(CPACK_PACKAGE_VERSION "0.9.7")
396+
set(CPACK_PACKAGE_VERSION "0.9.8")
397397
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Firelight")
398398
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
399399
set(CPACK_PACKAGE_EXECUTABLES "firelight;Firelight")
@@ -461,5 +461,6 @@ install(
461461
DESTINATION ${CMAKE_INSTALL_BINDIR}/system/
462462
)
463463

464+
set(CPACK_INSTALL_SCRIPT "${CMAKE_SOURCE_DIR}/cpack_portable.cmake")
464465

465466
include(CPack)

cpack_portable.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (CPACK_GENERATOR STREQUAL "ZIP")
2+
file(WRITE "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/bin/portable.txt" "This is a portable build.")
3+
endif ()

src/app/rcheevos/ra_constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ namespace firelight::achievements {
66
constexpr int UNSUPPORTED_EMULATOR_ACHIEVEMENT_ID = 101000001;
77
const std::string RA_DOREQUEST_URL =
88
"https://retroachievements.org/dorequest.php";
9-
const std::string USER_AGENT = "Firelight/0.9.7";
9+
const std::string USER_AGENT = "Firelight/0.9.8";
1010
const std::string OFFLINE_USER_AGENT = USER_AGENT + " [offline]";
1111
} // namespace firelight::achievements

src/main.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,6 @@
6868
#include <saves/gui/save_files_item.hpp>
6969
#include <unistd.h>
7070

71-
bool create_dirs(const std::initializer_list<std::filesystem::path> list) {
72-
std::error_code error_code;
73-
for (const auto &path : list) {
74-
if (!exists(path)) {
75-
spdlog::info("Directory not found, creating: {}", path.string());
76-
if (!create_directories(path, error_code)) {
77-
spdlog::error("Unable to create directory {}; Error code: {}",
78-
path.string(), error_code.message());
79-
return false;
80-
}
81-
}
82-
}
83-
return true;
84-
}
85-
8671
int main(int argc, char *argv[]) {
8772
// SDL_setenv("QT_QUICK_FLICKABLE_WHEEL_DECELERATION", "5000", true);
8873

@@ -120,19 +105,33 @@ int main(int argc, char *argv[]) {
120105

121106
std::signal(SIGINT, [](int signal) { QGuiApplication::quit(); });
122107

123-
// TODO: Check for portable mode marker file
124-
125-
auto defaultUserPathString =
126-
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
127108
auto docsPath =
128109
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) +
129110
"/Firelight";
130-
auto savesPath = docsPath + "/saves";
131-
auto romsPath = docsPath + "/roms";
132111

133112
auto defaultAppDataPathString =
134113
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
135114

115+
QFileInfo info(QCoreApplication::applicationDirPath() + "/portable.txt");
116+
if (info.exists()) {
117+
spdlog::info("Found \"portable.txt\"; Enabling portable mode");
118+
docsPath = QCoreApplication::applicationDirPath();
119+
defaultAppDataPathString = docsPath + "/appdata";
120+
}
121+
122+
auto savesPath = docsPath + "/saves";
123+
auto romsPath = docsPath + "/roms";
124+
125+
QFileInfo savesDirInfo(savesPath);
126+
if (!savesDirInfo.exists() && QDir().mkpath(savesPath)) {
127+
spdlog::info("Created saves directory at {}", savesPath.toStdString());
128+
}
129+
130+
QFileInfo romsDirInfo(romsPath);
131+
if (!romsDirInfo.exists() && QDir().mkpath(romsPath)) {
132+
spdlog::info("Created roms directory at {}", romsPath.toStdString());
133+
}
134+
136135
QSettings::setPath(QSettings::Format::IniFormat, QSettings::Scope::UserScope,
137136
defaultAppDataPathString);
138137

0 commit comments

Comments
 (0)