#include "uicomponents/UIComponents.h"
#include <vector>
#include <string.h>
-#include <string>
#include <iostream>
#include "common/text.h"
#include "common/typed_text.h"
#include "font/ui_font.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
namespace OHOS
{
}
printf("%s\r\n",str_);
}
+
+ /*创建文件夹*/
+ void CreateDirectoryIfNotExists(const std::string &path) {
+ struct stat info;
+ if (stat(path.c_str(), &info) != 0) {
+ if (mkdir(path.c_str(), 0755) != 0) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+ "Error: Could not create directory %s. Errno: %d",
+ path.c_str(), errno);
+ } else {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Created directory: %s",
+ path.c_str());
+ }
+ } else if (info.st_mode & S_IFDIR) {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Directory already exists: %s",
+ path.c_str());
+ }
+ }
}