#!/bin/bash

ud=~/.config/user-dirs.dirs
tst=$(mktemp ./testXXXXXXXX)
trap "rm $tst" EXIT

gcc $(pkg-config glib-2.0 --cflags) -o $tst -x c - $(pkg-config glib-2.0 --libs) <<EOF
	#include <glib.h>
	#include <stdio.h>
	int main () {
		const char *dir = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD);
		printf("G_USER_DIRECTORY_DOWNLOAD is %s\n", dir ? dir : "NULL");
	}
EOF

$tst
mv -v $ud $ud~
$tst
mv -v $ud~ $ud
