超长路径json文件解析适配

Signed-off-by: fangyunzhong <fangyunzhong2@huawei.com>
This commit is contained in:
fangyunzhong
2023-04-20 09:14:22 +00:00
parent d03e8c4932
commit 035a4bac2f
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ bool ResourceUtil::RmoveAllDir(const string &path)
bool ResourceUtil::OpenJsonFile(const string &path, Json::Value &root)
{
ifstream ifs(path, ios::binary);
ifstream ifs(FileEntry::AdapateLongPath(path), ios::binary);
if (!ifs.is_open()) {
cerr << "Error: open json failed '" << path << "', reason: " << strerror(errno) << endl;
return false;
@@ -98,7 +98,7 @@ bool ResourceUtil::SaveToJsonFile(const string &path, const Json::Value &root)
writerBuilder["indentation"] = " ";
writerBuilder["emitUTF8"] = true;
unique_ptr<Json::StreamWriter> writer(writerBuilder.newStreamWriter());
ofstream out(path, ofstream::out | ofstream::binary);
ofstream out(FileEntry::AdapateLongPath(path), ofstream::out | ofstream::binary);
if (!out.is_open()) {
cerr << "Error: open failed '" << path <<"', reason: " << strerror(errno) << endl;
return false;