- if(!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
- sg_size_t *psize, *new_psize;
- psize = (sg_size_t*)
- xbt_dict_get_or_null(findStorageOnMountList(fd->mount)->p_content,
- fd->name);
- new_psize = xbt_new(sg_size_t, 1);
- *new_psize = *psize;
- if (psize){// src file exists
- xbt_dict_remove(findStorageOnMountList(fd->mount)->p_content, fd->name);
- char *path = (char *) xbt_malloc ((strlen(fullpath)-strlen(fd->mount)+1));
- strncpy(path, fullpath+strlen(fd->mount),
- strlen(fullpath)-strlen(fd->mount)+1);
- xbt_dict_set(findStorageOnMountList(fd->mount)->p_content, path,
- new_psize,NULL);
- XBT_DEBUG("Move file from %s to %s, size '%llu'",fd->name, fullpath, *psize);
- free(path);
+ if (!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
+ sg_size_t* psize = (sg_size_t*)xbt_dict_get_or_null(findStorageOnMountList(fd->mount)->content_, fd->name);
+ if (psize) { // src file exists
+ sg_size_t* new_psize = xbt_new(sg_size_t, 1);
+ *new_psize = *psize;
+ xbt_dict_remove(findStorageOnMountList(fd->mount)->content_, fd->name);
+ std::string path = std::string(fullpath).substr(strlen(fd->mount), strlen(fullpath));
+ xbt_dict_set(findStorageOnMountList(fd->mount)->content_, path.c_str(), new_psize, nullptr);
+ XBT_DEBUG("Move file from %s to %s, size '%llu'", fd->name, fullpath, *psize);