Skip to content

Conversation

@1-newbie
Copy link

@1-newbie 1-newbie commented Dec 10, 2025

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Greptile Overview

Greptile Summary

This PR fixes a file size retrieval bug specific to HarmonyOS Next sandbox environment. The issue was that the getFileSize() method in the HarmonyOS platform adapter was incorrectly attempting to handle absolute file paths (starting with '/') using the HarmonyOS ResourceManager API, which is intended only for bundled assets. The fix adds a simple check to delegate absolute paths to the base FileUtils::getFileSize() method, ensuring they are handled by standard filesystem operations instead.

This change aligns with the existing pattern already implemented in other methods like getContents() and isFileExistInternal(), creating consistency across the HarmonyOS file handling implementation. The change is platform-specific and contained within the HarmonyOS adapter, maintaining the engine's cross-platform file access abstraction while properly supporting both asset bundle files and absolute filesystem paths on HarmonyOS.

Important Files Changed

Filename Score Overview
native/cocos/platform/openharmony/FileUtils-OpenHarmony.cpp 5/5 Added absolute path check in getFileSize() method to delegate to base FileUtils for paths starting with '/'

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it fixes a specific platform bug without affecting other systems
  • Score reflects a simple, well-targeted fix that follows existing patterns in the codebase and addresses a clear functional issue
  • No files require special attention as the change is straightforward and follows established conventions

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@github-actions
Copy link

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1009738 bytes 1009738 bytes ✅ 0 bytes
2D All (legacy pipeline) 2675347 bytes 2675347 bytes ✅ 0 bytes
2D All (new pipeline) 2767083 bytes 2767083 bytes ✅ 0 bytes
(2D + 3D) All 10024081 bytes 10024081 bytes ✅ 0 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16843143 bytes 16843143 bytes ✅ 0 bytes

Interface Check Report

This pull request does not change any public interfaces !

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.

1 participant