@kugel- requested changes on this pull request.
In src/utils.c:
> + if (size > PATH_MAX) + return NULL; + else + return resolved_path; + } + else + { + size = GetFullPathNameA(pathname, 0, NULL, NULL); + resolved_path = g_new0(char, size); + GetFullPathNameA(pathname, size, resolved_path, NULL); + return resolved_path; + } +} +#endif + + /** * Get a link-dereferenced, absolute version of a file name. * * This is similar to the POSIX `realpath` function when passed a * @c NULL argument.
I think we can be clear here and say that this is realpath, except on Windows.
In src/utils.c:
> @@ -2436,7 +2463,12 @@ void utils_start_new_geany_instance(const gchar *doc_path) GEANY_API_SYMBOL gchar *utils_get_real_path(const gchar *file_name) { - return tm_get_real_path(file_name); + gchar *path = NULL; + + if (file_name) + path = realpath(file_name, NULL);
We don't really need to implement a wrapper for realpath()
if the only caller always passes NULL.
I suggest this
gchar *path = NULL;
if (file_name)
{
#if defined(G_OS_WIN32) && !defined(HAVE_REALPATH)
gsize size = GetFullPathNameA(pathname, 0, NULL, NULL);
path = g_new0(char, size);
GetFullPathNameA(pathname, size, path, NULL);
#else
path = realpath(file_name, NULL);
#endif
}
return path;
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.