Repository navigation
Conversation
A home directory that does not exist is an environment problem rather than the SDK's: macOS and Linux fall back to a relative GameAnalytics folder instead of creating it. Windows has no such guard and creates the tree, so the test asserts each platform's current behaviour.
The validator only requires 32 and 40 alphanumeric characters, so the tests do not need real credentials.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 58.79% 59.27% +0.48%
==========================================
Files 23 23
Lines 3060 3067 +7
Branches 1512 1518 +6
==========================================
+ Hits 1799 1818 +19
+ Misses 939 924 -15
- Partials 322 325 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved path-handling defects break Windows log diagnostics and database-size enforcement, can throw during Linux HOME resolution, and leave SQLite handles open during test cleanup.
4 open issues
What changed in this PR
This PR addresses database failures with non-ASCII writable paths, updating how the SDK handles paths for storage and logging.
Changes:
- Use UTF-8-aware filesystem conversions for Windows paths, database files, and log files.
- Update persistent-directory creation and error handling across platforms.
- Add persistent-path tests and replace existing test credentials with placeholder values.
| File | Description |
|---|---|
| test/GAValidatorTests.cpp | Replace validator test credentials. |
| test/GATests.cpp | Update shared test credentials and database key. |
| test/GAStateTests.cpp | Update the state-test game key. |
| test/GAPersistentPathTests.cpp | Add default, custom, Unicode, and unwritable-path tests. |
| test/GameAnalyticsApiTests.cpp | Replace API test credentials. |
| test/GAEventsTests.cpp | Replace event test credentials. |
| source/gameanalytics/Platform/GAWin32.cpp | Resolve the persistent path using wide characters and return UTF-8. |
| source/gameanalytics/Platform/GAMacOS.cpp | Use recursive directory creation with error-code handling. |
| source/gameanalytics/Platform/GALinux.cpp | Add HOME fallback handling and filesystem-based directory creation. |
| source/gameanalytics/GAStore.cpp | Use UTF-8 database paths and create missing directory trees. |
| source/gameanalytics/GALogger.cpp | Open log files through a UTF-8-aware filesystem path. |
Review effort: Balanced
Comment on lines
+93
to
96
| std::filesystem::path logFilePath = std::filesystem::u8path(writablepath); | ||
| logFilePath /= LOG_FILE_NAME; | ||
|
|
||
| logFile.open(logFilePath, std::ios::out | std::ios::trunc); |
|
|
||
| dbPath = (p / DATABASE_NAME).string(); | ||
| if(!std::filesystem::exists(p)) | ||
| dbPath = (p / DATABASE_NAME).u8string(); |
| if(homeDir && strlen(homeDir)) | ||
| { | ||
| return path; | ||
| if(std::filesystem::exists(homeDir)) |
| void TearDown() override | ||
| { | ||
| device::GADevice::setWritablePath(_originalWritablePath); | ||
| EXPECT_TRUE(store::GAStore::ensureDatabase(false, kGameKey)); |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Non-ascii characters in the path would result in a non-working database. This fixes it.