Skip to content

Non ascii path - #60

Open
dorin-ga wants to merge 6 commits into
mainfrom
non_ascii_path
Open

dorin-ga wants to merge 6 commits into
mainfrom
non_ascii_path

Conversation

@dorin-ga

Copy link
Copy Markdown
Collaborator

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

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-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.27%. Comparing base (82b7a08) to head (3919638).

Files with missing lines Patch % Lines
source/gameanalytics/Platform/GALinux.cpp 72.72% 0 Missing and 3 partials ⚠️
source/gameanalytics/GALogger.cpp 75.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants