formats/settings/m_settings_writer.c
/* Ensure the full path for writing a file exists. */
Ensure the full path for writing a file exists.
Ensure the full path for writing a file exists .
static M_bool M_settings_write_create_path(const M_settings_t *settings)
{
	char *dirname;
	dirname = M_fs_path_dirname(M_settings_filename(settings), M_FS_SYSTEM_AUTO);
	if (dirname == NULL)
		return M_FALSE;
	if (M_fs_perms_can_access(dirname, 0) == M_FS_ERROR_SUCCESS) {
		M_free(dirname);
		return M_TRUE;
	}
	if (M_fs_dir_mkdir(dirname, M_TRUE, NULL) != M_FS_ERROR_SUCCESS) {
		M_free(dirname);
		return M_FALSE;
	}
	M_free(dirname);
	return M_TRUE;
}
static M_bool M_settings_write_create_path ( const M_settings_t * settings ) { char * dirname ; dirname = M_fs_path_dirname ( M_settings_filename ( settings ) , M_FS_SYSTEM_AUTO ) ; if ( dirname == NULL ) return M_FALSE ; if ( M_fs_perms_can_access ( dirname , 0 ) == M_FS_ERROR_SUCCESS ) { M_free ( dirname ) ; return M_TRUE ; } if ( M_fs_dir_mkdir ( dirname , M_TRUE , NULL ) != M_FS_ERROR_SUCCESS ) { M_free ( dirname ) ; return M_FALSE ; } M_free ( dirname ) ; return M_TRUE ; }
Ensure the full path for writing a file exists.
Ensure the full path for writing a file exists .
/* Get the dirname from the path */ /* Check if the path exists. */ /* Create the path. */