1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge branch '3.0release' into 4.0release

This commit is contained in:
winlin 2020-03-21 19:36:16 +08:00
commit 955de3dac9
4 changed files with 57 additions and 45 deletions

View file

@ -652,15 +652,20 @@ bool srs_path_exists(std::string path)
string srs_path_dirname(string path)
{
std::string dirname = path;
// No slash, it must be current dir.
size_t pos = string::npos;
if ((pos = dirname.rfind("/")) != string::npos) {
if (pos == 0) {
return "/";
}
dirname = dirname.substr(0, pos);
if ((pos = dirname.rfind("/")) == string::npos) {
return "./";
}
// Path under root.
if (pos == 0) {
return "/";
}
// Fetch the directory.
dirname = dirname.substr(0, pos);
return dirname;
}

View file

@ -335,8 +335,8 @@ void show_macro_features()
#endif
#if VERSION_MAJOR > VERSION_STABLE
#warning "Current branch is unstable."
srs_warn("Develop is unstable, please use branch: git checkout -b %s origin/%s", VERSION_STABLE_BRANCH, VERSION_STABLE_BRANCH);
#warning "Current branch is beta."
srs_warn("%s/%s is beta", RTMP_SIG_SRS_KEY, RTMP_SIG_SRS_VERSION);
#endif
#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF)

View file

@ -2565,7 +2565,7 @@ VOID TEST(KernelUtility, BytesUtils)
VOID TEST(KernelUtility, PathUtils)
{
if (true) {
EXPECT_TRUE("" == srs_path_dirname(""));
EXPECT_TRUE("./" == srs_path_dirname(""));
EXPECT_TRUE("/" == srs_path_dirname("/"));
EXPECT_TRUE("/" == srs_path_dirname("//"));
EXPECT_TRUE("/" == srs_path_dirname("/stream"));