]> git.donarmstrong.com Git - lilypond.git/commit
Issue 5077/2: Improve portability of get_working_directory()
authorMasamichi Hosoda <trueroad@trueroad.jp>
Sat, 11 Mar 2017 10:12:15 +0000 (19:12 +0900)
committerMasamichi Hosoda <trueroad@trueroad.jp>
Sun, 19 Mar 2017 14:45:34 +0000 (23:45 +0900)
commit9fd7a4d08b6414ce4b5b130316b688f36c6a6265
tree9d4bc54e5c4cff9a318448c57fe1767d4b86b528
parente632a63b594206ed96f34f75b813411857af6a49
Issue 5077/2: Improve portability of get_working_directory()

We used `getcwd()` with `PATH_MAX` to get the current directory.
However, `PATH_MAX` does not exist in environments such as GNU Hurd.
Debian developers avoided `PATH_MAX`
by using `get_current_dir_name()` instead of `getcwd()`.
It needed to protected with `#ifdef _GNU_SOURCE`
since `get_current_dir_name()` is glibc specific.
So `PATH_MAX` was still required in non-glibc environments.

There is a `getcwd()` extention that can avoid `PATH_MAX`
by setting the first argument to NULL.
The extension can be used in many environments, including glibc,
but POSIX does not recommend it in conforming applications.

This commit improves portability
by obtaining the current directory
with a method conforming to the standard.
flower/file-name.cc