mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-19 11:31:44 -04:00
@@ -57,12 +57,12 @@ public:
|
||||
static bool CopyFileInner(const std::string &src, const std::string &dst);
|
||||
static bool IsDirectory(const std::string &path);
|
||||
static std::string RealPath(const std::string &path);
|
||||
static std::string AdapateLongPath(const std::string &path);
|
||||
|
||||
private:
|
||||
bool IsIgnore(const std::string &filename) const;
|
||||
static bool RemoveAllDirInner(const FileEntry &entry);
|
||||
static bool CreateDirsInner(const std::string &path, std::string::size_type offset);
|
||||
static std::string AdapateLongPath(const std::string &path);
|
||||
FilePath filePath_;
|
||||
bool isFile_;
|
||||
static const std::string SEPARATE;
|
||||
|
||||
+2
-2
@@ -360,15 +360,15 @@ void FileEntry::FilePath::Init()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
string FileEntry::AdapateLongPath(const string &path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (path.size() >= MAX_PATH -12) { //the max file path can not exceed 260 - 12
|
||||
return LONG_PATH_HEAD + path;
|
||||
}
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user