mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 00:07:19 +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:
		@@ -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);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user