File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 88** -------------------------------------------------------------------------*/
99
1010#include < signal.h>
11+
12+ #ifndef _WIN32
1113#include < libgen.h>
14+ #endif
1215
1316#include < iostream>
1417#include < fstream>
@@ -57,16 +60,33 @@ class TurnRedirector : public webrtc::TurnRedirectInterface
5760 }
5861};
5962
60- std::string GetDefaultRessourceDir (const char * argv0) {
61- char resolvedPath[PATH_MAX];
63+ std::string GetExeDir (const char * argv0) {
6264 std::string exeDir;
65+ char resolvedPath[PATH_MAX];
66+ #ifdef _WIN32
67+ if (GetModuleFileNameA (NULL , resolvedPath, MAX_PATH)) {
68+ std::string fullPath (resolvedPath);
69+ size_t pos = fullPathStr.find_last_of (" \\ /" );
70+ if (pos != std::string::npos) {
71+ exeDir = fullPathStr.substr (0 , pos + 1 );
72+ }
73+ }
74+ #else
6375 if (realpath (argv0, resolvedPath)) {
6476 std::string fullPath (resolvedPath);
6577 exeDir = dirname (resolvedPath);
6678 exeDir += " /" ;
6779 }
80+ #endif
81+ return exeDir;
82+ }
83+
84+
85+ std::string GetDefaultRessourceDir (const char * argv0) {
86+
6887 std::string ressourceDir (WEBRTCSTREAMERRESSOURCE);
6988 if (ressourceDir[0 ] != ' /' ) {
89+ std::string exeDir = GetExeDir (argv0);
7090 ressourceDir = exeDir + ressourceDir;
7191 }
7292
You can’t perform that action at this time.
0 commit comments