MCPcopy Create free account
hub / github.com/audacity/audacity / getApplicationPath

Function getApplicationPath

libraries/lib-vst3/module_linux.cpp:92–113  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

90
91//------------------------------------------------------------------------
92Optional<Path> getApplicationPath ()
93{
94 std::string appPath = "";
95
96 pid_t pid = getpid ();
97 char buf[10];
98 sprintf (buf, "%d", pid);
99 std::string _link = "/proc/";
100 _link.append (buf);
101 _link.append ("/exe");
102 char proc[1024];
103 int ch = readlink (_link.c_str (), proc, 1024);
104 if (ch == -1)
105 return {};
106
107 proc[ch] = 0;
108 appPath = proc;
109 std::string::size_type t = appPath.find_last_of ("/");
110 appPath = appPath.substr (0, t);
111
112 return Path {appPath};
113}
114
115//------------------------------------------------------------------------
116class LinuxModule : public Module

Callers 1

getModulePathsMethod · 0.85

Calls 2

appendMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected