统一处理输入目录

Signed-off-by: fangyunzhong <fangyunzhong2@huawei.com>
This commit is contained in:
fangyunzhong
2023-05-26 02:06:41 +00:00
parent 668a3e7582
commit 915d49ab63
9 changed files with 64 additions and 24 deletions
+12 -2
View File
@@ -72,7 +72,7 @@ bool ResourceUtil::RmoveAllDir(const string &path)
bool ResourceUtil::OpenJsonFile(const string &path, Json::Value &root)
{
ifstream ifs(FileEntry::AdapateLongPath(path), ios::binary);
ifstream ifs(FileEntry::AdaptLongPath(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(FileEntry::AdapateLongPath(path), ofstream::out | ofstream::binary);
ofstream out(FileEntry::AdaptLongPath(path), ofstream::out | ofstream::binary);
if (!out.is_open()) {
cerr << "Error: open failed '" << path <<"', reason: " << strerror(errno) << endl;
return false;
@@ -392,6 +392,16 @@ string ResourceUtil::GetAllRestypeString()
return result;
}
FileEntry::FilePath ResourceUtil::GetBaseElementPath(const string input)
{
return FileEntry::FilePath(input).Append("base").Append("element");
}
FileEntry::FilePath ResourceUtil::GetMainPath(const string input)
{
return FileEntry::FilePath(input).GetParent();
}
}
}
}