EXAPI bool
scim_make_dir (const String &dir)
{
- std::vector <String> paths;
- String path;
+ if (access (dir.c_str (), R_OK) != 0) {
+ std::vector <String> paths;
+ String path;
- scim_split_string_list (paths, dir, SCIM_PATH_DELIM);
+ scim_split_string_list (paths, dir, SCIM_PATH_DELIM);
- for (size_t i = 0; i < paths.size (); ++i) {
- path += SCIM_PATH_DELIM_STRING + paths [i];
+ for (size_t i = 1; i < paths.size (); ++i) {
+ path += SCIM_PATH_DELIM_STRING + paths [i];
- //Make the dir if it's not exist.
- if (access (path.c_str (), R_OK) != 0) {
- if (mkdir (path.c_str (), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0)
- return false;
+ //Make the dir if it's not exist.
+ if (access (path.c_str (), R_OK) != 0) {
+ if (mkdir (path.c_str (), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0)
+ return false;
- if (access (path.c_str (), R_OK) != 0)
- return false;
+ if (access (path.c_str (), R_OK) != 0)
+ return false;
+ }
}
}
return true;