HarmonyOS platform packages (HiLog, RawFile, task cancellation) for MoonOHOS native modules.
| Package | Purpose | NDK library |
|---|---|---|
| shop1111/moonohos_ohos/hilog | Logger::new(domain, tag) with debug/info/warn/error/fatal; messages are passed as a %{public}s argument, never as the format string | libhilog_ndk.z.so |
| shop1111/moonohos_ohos/rawfile | read, read_text, list for packaged resources/rawfile files through a borrowed Manager (adapted from ArkTS resourceManager) | librawfile.z.so |
| shop1111/moonohos_ohos/task | cancelled() / check() observe the CancelToken of the running MoonOHOS async task | — |
/// Counts packaged documents on a worker thread, logging progress.
pub fn count_documents(resources : @rawfile.Manager, dir : String) -> Int raise {
let log = @hilog.Logger::new(0x4d4f, "MySearch")
let mut characters = 0
for name in @rawfile.list(resources, dir) {
@task.check()
characters += @rawfile.read_text(resources, dir + "/" + name).length()
}
log.info("indexed " + dir + ": " + characters.to_string() + " characters")
characters
}Install
Download zipHarmonyOS platform packages (HiLog, RawFile, task cancellation) for MoonOHOS native modules.