2019-07-05 20:16:15 +03:00
|
|
|
// SPDX-License-Identifier: LGPL-2.1
|
|
|
|
// Copyright (C) 2018, 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
|
2018-11-19 22:56:22 +03:00
|
|
|
//
|
|
|
|
#ifndef HAVE_GET_CURRENT_DIR_NAME
|
2019-07-05 20:16:15 +03:00
|
|
|
#include "get_current_dir_name.h"
|
2018-11-19 22:56:22 +03:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
/* Android's 'bionic' library, for one, doesn't have this */
|
|
|
|
|
|
|
|
char *get_current_dir_name(void)
|
|
|
|
{
|
|
|
|
char pwd[PATH_MAX];
|
|
|
|
|
|
|
|
return getcwd(pwd, sizeof(pwd)) == NULL ? NULL : strdup(pwd);
|
|
|
|
}
|
|
|
|
#endif // HAVE_GET_CURRENT_DIR_NAME
|