fix miss PATH_MAX
All checks were successful
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 36s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 35s

This commit is contained in:
tqcq 2024-03-03 17:25:08 +08:00
parent d048a2676c
commit 5413784c57

View File

@ -3,12 +3,18 @@
#include <errno.h>
#include <unistd.h>
#ifndef PATH_MAX
#define PATH_MAX_SZ 4096
#else
#define PATH_MAX_SZ PATH_MAX
#endif
namespace sled {
Path
Path::Current()
{
char tmp_path[PATH_MAX];
if (getcwd(tmp_path, PATH_MAX)) {
char tmp_path[PATH_MAX_SZ];
if (getcwd(tmp_path, PATH_MAX_SZ)) {
auto cwd = Path(tmp_path);
return cwd;
}