For #1635, refine inotify watch for relative path

pull/1651/head
winlin 5 years ago
parent 88336b1f5e
commit 8db2c3d821

@ -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) {
return "./";
}
if ((pos = dirname.rfind("/")) != string::npos) {
// Path under root.
if (pos == 0) {
return "/";
}
dirname = dirname.substr(0, pos);
}
// Fetch the directory.
dirname = dirname.substr(0, pos);
return dirname;
}

Loading…
Cancel
Save