1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Include the header that contains the PATH_MAX on linux in system environment library.

Use Append string instead of Write string when writing data to a buffer.
Remove leftover semicolon in 'else if' statement.
This commit is contained in:
Sandu Liviu Catalin 2016-03-27 18:54:45 +03:00
parent e70afea7ad
commit e0c2c01e25

View File

@ -12,6 +12,7 @@
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
#else #else
#include <linux/limits.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>
@ -71,7 +72,7 @@ void SysEnv::Get(Buffer & b, CCStr name, CCStr fallback)
if (!val) if (!val)
{ {
// Write the fall-back value into the buffer instead // Write the fall-back value into the buffer instead
Buffer.AppendS(fallback); b.AppendS(fallback);
} }
else else
{ {
@ -728,7 +729,7 @@ void SysEnv::HomeDir(Buffer & b)
b.AppendS(pwd->pw_dir); b.AppendS(pwd->pw_dir);
} }
// Fall back to the system environment variables // Fall back to the system environment variables
else if (Has("HOME");) else if (Has("HOME"))
{ {
// Append the contents of the HOME environment variable // Append the contents of the HOME environment variable
Get(b, "HOME", nullptr); Get(b, "HOME", nullptr);
@ -984,7 +985,7 @@ void SysEnv::ConfigDir(Buffer & b)
} }
#else #else
// Default to "/etc" directory // Default to "/etc" directory
b.WriteS("/etc/"); b.AppendS("/etc/");
#endif // SQMOD_OS_WINDOWS #endif // SQMOD_OS_WINDOWS
// Make sure that the path is properly terminated // Make sure that the path is properly terminated
TerminatePath(b); TerminatePath(b);
@ -1031,7 +1032,7 @@ void SysEnv::SystemDir(Buffer & b)
b.Advance(len); b.Advance(len);
#else #else
// Use a dummy directory for now // Use a dummy directory for now
b.WriteS("/sys/"); b.AppendS("/sys/");
#endif // SQMOD_OS_WINDOWS #endif // SQMOD_OS_WINDOWS
// Make sure that the path is properly terminated // Make sure that the path is properly terminated
TerminatePath(b); TerminatePath(b);