Skip to content

Commit 59e0fa2

Browse files
committed
fix ignore of download ressources
1 parent c36c2d7 commit 59e0fa2

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/main.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
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

0 commit comments

Comments
 (0)