MCPcopy Create free account
hub / github.com/VitalAudio/visage / hostExecutable

Function hostExecutable

visage_utils/file_system.cpp:126–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124 }
125
126 File hostExecutable() {
127#if VISAGE_WINDOWS
128 static File path;
129 if (path.empty()) {
130 char buffer[MAX_PATH];
131 GetModuleFileNameA(nullptr, buffer, MAX_PATH);
132 path = buffer;
133 }
134 return path;
135#elif VISAGE_MAC
136 static constexpr int kMaxPathLength = 1 << 14;
137 char path[kMaxPathLength];
138 uint32_t size = kMaxPathLength - 1;
139 if (_NSGetExecutablePath(path, &size))
140 return {};
141
142 path[size] = '\0';
143 return std::filesystem::canonical(path);
144#else
145 static constexpr int kMaxPathLength = 1 << 14;
146 char path[kMaxPathLength];
147 ssize_t size = readlink("/proc/self/exe", path, kMaxPathLength - 1);
148 if (size < 0)
149 return {};
150
151 path[size] = '\0';
152 return std::filesystem::canonical(path);
153#endif
154 }
155
156 File appDataDirectory() {
157#if VISAGE_WINDOWS

Callers 3

hostNameFunction · 0.85
setupButtonsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected