shithub: mc

ref: 6d707df71c0fe11da7dd53bf36eb3d3fadb8ec9b
dir: /lib/fileutil/homedir.myr/

View raw version
use std

pkg fileutil =
	const homedir	: (-> byte[:])
;;

const homedir = {
	match std.getenv("HOME")
	| `std.Some h:	-> h
	| `std.None:	/* nothing */
	;;

	/* 9front uses $home */
	match std.getenv("home")
	| `std.Some h:	-> h
	| `std.None:	/* nothing */
	;;

	/* really, we should read from /etc/passwd or ldap/nss */
	-> ""
}