/* This file is part of Lcrzo.
*/

int lcrzo_dir_create(const char *dirname)
{ int ret;
  lcrzo_string cleandirname;

  lcrzo_er(lcrzo_priv_dirname_removelastslash(dirname, &cleandirname));
  lcrzo_er(lcrzo_priv_dir_eventually_create_parent(cleandirname));
#if defined LCRZODEF_SYSTEM_Unix
  ret=mkdir(cleandirname, 0700);
#elif defined LCRZODEF_SYSTEM_Windows
  ret=_mkdir(cleandirname);
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif
  lcrzo_string_free(cleandirname);
  if (ret==-1) return(LCRZO_ERR_FUMKDIR);

  return(LCRZO_ERR_OK);
}

