juk3n/fluffypublic Fork
⑂ 5584994
Commits
⬇ Clone ▾
git clone https://git.rickub.com/juk3n/fluffy.git
git clone ssh://git@rickub.com/juk3n/fluffy.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Merge pull request #14 from Juk3n/13-add-storing-data-in-fluffy-folderUnverified

added finding proper path for database
Adrian Duraj committed 2024-06-28T16:31:43+02:00 Browse files
5584994 parents: 1b488bf 9a2eaf5
modified README.md +35 -1
@@ -1 +1,35 @@
1-# fluffy
\ No newline at end of file
1+# fluffy - terminal game launcher
2+
3+(only on linux)
4+
5+Fluffy's goal is to provide simple and fast possibility to run games from user defined directories and store all the required paths in one place.
6+
7+## Usage
8+
9+### Command-line options
10+
11+- fluffy show - show list of games
12+
13+```console
14+user:~/some/path$ fluffy show
15+game_name: /path/to/your/game
16+```
17+
18+- fluffy add <game_name> <game_path> - add a game
19+
20+```console
21+user:~/some/path$ fluffy add game_name path/to/your/game
22+```
23+
24+- fluffy rm <game_name> - remove a game
25+
26+```console
27+user:~/some/path$ fluffy rm game_name
28+```
29+
30+- fluffy - runs a fluffy gui from which the game can be run
31+![fluffy 0.1](screenshots/fluffy_0_1.png)
32+
33+## Installation
34+
35+(work in progress)
@@ -1 +1,35 @@
1-# fluffy
\ No newline at end of file\ No newline at end of file
1+# fluffy - terminal game launcher
2+
3+(only on linux)
4+
5+Fluffy's goal is to provide simple and fast possibility to run games from user defined directories and store all the required paths in one place.
6+
7+## Usage
8+
9+### Command-line options
10+
11+- fluffy show - show list of games
12+
13+```console
14+user:~/some/path$ fluffy show
15+game_name: /path/to/your/game
16+```
17+
18+- fluffy add <game_name> <game_path> - add a game
19+
20+```console
21+user:~/some/path$ fluffy add game_name path/to/your/game
22+```
23+
24+- fluffy rm <game_name> - remove a game
25+
26+```console
27+user:~/some/path$ fluffy rm game_name
28+```
29+
30+- fluffy - runs a fluffy gui from which the game can be run
31+![fluffy 0.1](screenshots/fluffy_0_1.png)
32+
33+## Installation
34+
35+(work in progress)
added screenshots/fluffy_0_1.png +0 -0
new file mode 100644
Binary files /dev/null and b/screenshots/fluffy_0_1.png differ
new file mode 100644
Binary files /dev/null and b/screenshots/fluffy_0_1.png differBinary files /dev/null and b/screenshots/fluffy_0_1.png differ
modified src/main.cpp +5 -3
@@ -28,7 +28,7 @@ std::string database_initialization_command =
2828
2929 std::string select_all_games_command = "SELECT * FROM games;";
3030
31-bool debugRun = true;
31+bool debugRun = false;
3232
3333 void printMessage(std::string message) {
3434 if (debugRun) {
@@ -169,12 +169,14 @@ auto runConsoleApp(sqlite3* database) -> void {
169169 }
170170
171171 auto main(int argc, char const *argv[]) -> int {
172- bool newCreation = not std::filesystem::exists("data.db");
172+ auto appPath{ std::filesystem::path(argv[0])};
173+ auto databasePath{ std::filesystem::path(appPath.parent_path().string() + "/data.db")};
174+ bool newCreation = not std::filesystem::exists(databasePath.string());
173175 char *messageError;
174176 sqlite3 *database;
175177 sqlite3_stmt *stmt;
176178 int exit = 0;
177- exit = sqlite3_open("data.db", &database);
179+ exit = sqlite3_open(databasePath.c_str(), &database);
178180
179181 if (exit) {
180182 std::cerr << "Error opening database" << sqlite3_errmsg(database)
@@ -28,7 +28,7 @@ std::string database_initialization_command =
28 28
29 std::string select_all_games_command = "SELECT * FROM games;";29 std::string select_all_games_command = "SELECT * FROM games;";
30 30
31-bool debugRun = true;31+bool debugRun = false;
32 32
33 void printMessage(std::string message) {33 void printMessage(std::string message) {
34 if (debugRun) {34 if (debugRun) {
@@ -169,12 +169,14 @@ auto runConsoleApp(sqlite3* database) -> void {
169 }169 }
170 170
171 auto main(int argc, char const *argv[]) -> int {171 auto main(int argc, char const *argv[]) -> int {
172- bool newCreation = not std::filesystem::exists("data.db");172+ auto appPath{ std::filesystem::path(argv[0])};
173+ auto databasePath{ std::filesystem::path(appPath.parent_path().string() + "/data.db")};
174+ bool newCreation = not std::filesystem::exists(databasePath.string());
173 char *messageError;175 char *messageError;
174 sqlite3 *database;176 sqlite3 *database;
175 sqlite3_stmt *stmt;177 sqlite3_stmt *stmt;
176 int exit = 0;178 int exit = 0;
177- exit = sqlite3_open("data.db", &database);179+ exit = sqlite3_open(databasePath.c_str(), &database);
178 180
179 if (exit) {181 if (exit) {
180 std::cerr << "Error opening database" << sqlite3_errmsg(database)182 std::cerr << "Error opening database" << sqlite3_errmsg(database)