Skip to content

Commit 2f26c12

Browse files
committed
implement username/getlogin() for macOS
1 parent 72231a9 commit 2f26c12

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tools/OBCViewer/OBCViewer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#ifdef __unix__
99
#include <unistd.h>
10+
#elif __APPLE__
11+
#include "../../../../../Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/usr/include/unistd.h"
1012
#endif
1113

1214
namespace fs = std::filesystem;
@@ -44,6 +46,8 @@ int main(int argc, char* argv[]) {
4446
#ifdef __unix__
4547
// List here everything for the Debug Infos.
4648
std::string username = getlogin();
49+
#elif __APPLE__
50+
std::string username = getlogin();
4751
#endif
4852

4953
// Check if the input file is an OBC Script.
@@ -116,6 +120,8 @@ int main(int argc, char* argv[]) {
116120
DebugInfoOutput << "Output of " << inputScript.stem().string() << ".obc" << " created at " << obc_timedate << std::endl;
117121
#ifdef __unix__
118122
DebugInfoOutput << "Created by " << username << std::endl;
123+
#elif __APPLE__
124+
DebugInfoOutput << "Created by " << username << std::endl;
119125
#endif
120126
DebugInfoOutput << "Offset (hex): 0x" << std::hex << offset << " hex" << std::dec << std::endl;
121127
DebugInfoOutput << "Offset (bytes): " << offset << " bytes" << std::dec << std::endl;

0 commit comments

Comments
 (0)