https://github.com/zhehaoli1999/DiffFR
Raw File
Tip revision: f7dc063b7f3c0330f345c5d52454c52c1f6f1f26 authored by Li Zhehao on 31 March 2024, 14:19:09 UTC
update readme to fix typo
Tip revision: f7dc063
SystemInfo.h
#ifndef __SystemInfo_h__
#define __SystemInfo_h__

#include "SPlisHSPlasH/Common.h"
#if WIN32
#define NOMINMAX
#include "windows.h"
#else
#include <unistd.h>
#include <limits.h>
#endif

namespace Utilities
{
	class SystemInfo
	{
	public:
		static std::string getHostName()
		{
#ifdef WIN32
			const unsigned int bufferSize = 32767;
			TCHAR  *infoBuf = new TCHAR[bufferSize];
			DWORD  bufCharCount = bufferSize;
			if (!GetComputerName(infoBuf, &bufCharCount))
				return "";
			std::string name = infoBuf;
			delete[] infoBuf;
			return name;
#else
			const unsigned int bufferSize = 32767;
			char hostname[bufferSize];
			gethostname(hostname, bufferSize);
			return hostname;
#endif
		}
	};
}

#endif
back to top