diff options
Diffstat (limited to 'src/gitto-path.c')
-rw-r--r-- | src/gitto-path.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gitto-path.c b/src/gitto-path.c new file mode 100644 index 0000000..ad1400a --- /dev/null +++ b/src/gitto-path.c @@ -0,0 +1,21 @@ +#include <stdlib.h> +#include <libguile.h> + +SCM +realpath_wrapper(SCM str) +{ + char *path = scm_to_locale_string(str); + char *resolved_path = realpath(path, NULL); + SCM scm_resolved_path = scm_from_locale_string(resolved_path); + + free(path); + free(resolved_path); + + return scm_resolved_path; +} + +void +init_gitto() +{ + scm_c_define_gsubr("realpath", 1, 0, 0, realpath_wrapper); +} |