anonymous print file name

Signed-off-by: wangpeng <wangpeng477@huawei.com>
This commit is contained in:
wangpggg 2024-08-28 10:15:33 +08:00
parent 23edd8c6a0
commit ed7497fd74
3 changed files with 9 additions and 8 deletions

View File

@ -171,7 +171,7 @@ static int64_t GetFileMtime(const string &fileName)
string filePath = RecentNExporter::recentPath_ + fileName;
struct stat statBuf;
if (lstat(filePath.c_str(), &statBuf) < 0) {
HILOG_ERROR("Failed to lstat uri, errno=%{public}d, fileName=%{public}s", errno, fileName.c_str());
HILOG_ERROR("Failed to lstat uri, errno=%{public}d, fileName=%{private}s", errno, fileName.c_str());
return errno;
}
return static_cast<int64_t>(statBuf.st_mtime);
@ -181,7 +181,7 @@ static string GetName(const string &path)
{
auto pos = path.find_last_of('/');
if (pos == string::npos) {
HILOGE("Failed to split filename from path, path: %{public}s", path.c_str());
HILOGE("Failed to split filename from path, path: %{private}s", path.c_str());
}
return path.substr(pos + 1);
}

View File

@ -185,7 +185,7 @@ static napi_value CreateObjectArray(napi_env env, vector<FileInfo> result)
static string FindSourceFilePath(const string &path)
{
HILOG_INFO("FindSourceFilePath: curFilePath = %{public}s", path.c_str());
HILOG_INFO("FindSourceFilePath: curFilePath = %{private}s", path.c_str());
size_t slashSize = 1;
// 获取/trash目录位置
size_t trashPathPrefixPos = path.find(FileTrashNExporter::trashPath_);
@ -213,7 +213,7 @@ static string FindSourceFilePath(const string &path)
string realFileName = realFilePath.substr(pos + TRASH_SUB_DIR.length() +
timeSlot.length() + slashSize);
realFilePath = "/" + realFilePathPrefix + realFileName;
HILOG_INFO("FindSourceFilePath: realFilePath After = %{public}s", realFilePath.c_str());
HILOG_INFO("FindSourceFilePath: realFilePath After = %{private}s", realFilePath.c_str());
return realFilePath;
}

View File

@ -307,17 +307,18 @@ int32_t FileAccessService::OperateObsNode(Uri &uri, bool notifyForDescendants, u
{
string uriStr = uri.ToString();
HILOG_INFO("OperateObsNode uriStr: %{public}s", uriStr.c_str());
shared_ptr<ObserverNode> obsNode;
{
lock_guard<mutex> lock(nodeMutex_);
auto iter = relationshipMap_.find(uriStr);
if (iter != relationshipMap_.end()) {
obsNode = iter->second;
auto obsNode = iter->second;
// this node has this callback or not, if has this, unref manager.
auto haveCodeIter = find_if(obsNode->obsCodeList_.begin(), obsNode->obsCodeList_.end(),
[code](const uint32_t &listCode) { return code == listCode; });
if (haveCodeIter != obsNode->obsCodeList_.end()) {
obsManager_.get(code)->UnRef();
if (obsManager_.get(code) != nullptr) {
obsManager_.get(code)->UnRef();
}
if (obsNode->needChildNote_ == notifyForDescendants) {
HILOG_DEBUG("Register same uri and same callback and same notifyForDescendants");
return ERR_OK;
@ -340,7 +341,7 @@ int32_t FileAccessService::OperateObsNode(Uri &uri, bool notifyForDescendants, u
extensionProxy->StartWatcher(uri);
{
lock_guard<mutex> lock(nodeMutex_);
obsNode = make_shared<ObserverNode>(notifyForDescendants);
auto obsNode = make_shared<ObserverNode>(notifyForDescendants);
// add new node relations.
for (auto &[comUri, node] : relationshipMap_) {
if (IsParentUri(comUri, uriStr)) {