Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore reading current directory from shell (#52)
* Read current directory from `PWD` * Obtaining the current directory from C++ was implemented in d5bf60c. (This commit changes it back to how it was earlier.) It probably involves a system call. Better to use the environment variable in Bash and Zsh. * Furthermore, in C++, the working directory is a wide-character string on Windows, so it cannot be safely printed to the error stream because it gets auto-configured to print narrow-character strings the moment the first item (which is a narrow-character string) gets printed. (Although GCC and Clang do not mess up the error stream, the C++ standard says that this might happen, because printing narrow- and wide-character strings to the same stream results in undefined behaviour, so I would rather not do that.) * To convert a wide-character string to narrow character string, the standard recommends using dedicated text-processing libraries, having deprecated the standard library functions for the same in C++17 (https://stackoverflow.com/q/42946335). Why deal with all that headache when the shell can supply the current directory. * Reduced line length by changing `git_info` to `main`, making it fit on a single line.
- Loading branch information