|
|
@@ -177,7 +177,7 @@ int unZipCurrentFile(zipFile zf, string destDirPath)
|
|
|
Dbg("error %d with zipfile in unzCloseCurrentFile", err);
|
|
|
return -1;
|
|
|
}
|
|
|
- if (changeFileAtt(fileNamePath.c_str())!=0) {
|
|
|
+ if (changeUnZipFileAtt(fileNamePath.c_str())!=0) {
|
|
|
return -1;
|
|
|
}
|
|
|
return 0;
|
|
|
@@ -252,6 +252,30 @@ bool is_str_utf8(const char* str)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+int changeUnZipFileAtt(const char* path)
|
|
|
+{
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
+ return 0;//windows 默认返回成功
|
|
|
+#else
|
|
|
+ struct stat attr_of_del;
|
|
|
+ if (lstat(path, &attr_of_del) == 0)
|
|
|
+ {
|
|
|
+ //修改为775属性
|
|
|
+ mode_t f_attrib = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
|
|
+ if (chmod(path, f_attrib) != 0)
|
|
|
+ {
|
|
|
+ Dbg("set file attribute is fail,errno=%d, file=%s", errno, path);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Dbg("get file attribute is fail,errno=%d, file=%s", errno, path);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
#ifdef RVC_OS_WIN
|
|
|
#else
|
|
|
unsigned char* utf8_string_create(const char* string) {
|
|
|
@@ -291,27 +315,4 @@ unsigned char* utf8_string_create(const char* string) {
|
|
|
return string_utf8;
|
|
|
}
|
|
|
|
|
|
-int changeFileAtt(const char* path)
|
|
|
-{
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- return 0;//windows 默认返回成功
|
|
|
-#else
|
|
|
- struct stat attr_of_del;
|
|
|
- if (lstat(path, &attr_of_del) == 0)
|
|
|
- {
|
|
|
- //修改为775属性
|
|
|
- mode_t f_attrib = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
|
|
- if (chmod(path, f_attrib) != 0)
|
|
|
- {
|
|
|
- Dbg("set file attribute is fail,errno=%d, file=%s", errno, path);
|
|
|
- return -1;
|
|
|
- }
|
|
|
- return 0;
|
|
|
- }
|
|
|
- else {
|
|
|
- Dbg("get file attribute is fail,errno=%d, file=%s", errno, path);
|
|
|
- return -1;
|
|
|
- }
|
|
|
-#endif
|
|
|
-}
|
|
|
-#endif //RVC_OS_WIN
|
|
|
+#endif //RVC_OS_WIN
|