Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2016-09-23 15:37:51 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3659eec9d1dbbd24fdd46f095ad91804a025322c
3659eec9
1 parent
07fe35f1
update the cwd
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
23 行增加
和
6 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/main/srs_main_server.cpp
trunk/src/app/srs_app_config.cpp
查看文件 @
3659eec
...
...
@@ -1339,11 +1339,6 @@ int SrsConfig::parse_options(int argc, char** argv)
}
}
// cwd
char
cwd
[
256
];
getcwd
(
cwd
,
sizeof
(
cwd
));
_cwd
=
cwd
;
// config
show_help
=
true
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
...
...
@@ -1411,6 +1406,18 @@ int SrsConfig::parse_options(int argc, char** argv)
return
ret
;
}
int
SrsConfig
::
initialize_cwd
()
{
int
ret
=
ERROR_SUCCESS
;
// cwd
char
cwd
[
256
];
getcwd
(
cwd
,
sizeof
(
cwd
));
_cwd
=
cwd
;
return
ret
;
}
string
SrsConfig
::
config
()
{
return
config_file
;
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
3659eec
...
...
@@ -288,6 +288,11 @@ public:
*/
virtual
int
parse_options
(
int
argc
,
char
**
argv
);
/**
* initialize the cwd for server,
* because we may change the workdir.
*/
virtual
int
initialize_cwd
();
/**
* get the config file path.
*/
virtual
std
::
string
config
();
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
3659eec
...
...
@@ -34,6 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <gperftools/profiler.h>
#endif
using
namespace
std
;
#include <srs_kernel_error.hpp>
#include <srs_app_server.hpp>
#include <srs_app_config.hpp>
...
...
@@ -283,11 +285,14 @@ int main(int argc, char** argv)
}
// change the work dir and set cwd.
st
d
::
st
ring
cwd
=
_srs_config
->
get_work_dir
();
string
cwd
=
_srs_config
->
get_work_dir
();
if
(
!
cwd
.
empty
()
&&
cwd
!=
"./"
&&
(
ret
=
chdir
(
cwd
.
c_str
()))
!=
ERROR_SUCCESS
)
{
srs_error
(
"change cwd to %s failed. ret=%d"
,
cwd
.
c_str
(),
ret
);
return
ret
;
}
if
((
ret
=
_srs_config
->
initialize_cwd
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// config parsed, initialize log.
if
((
ret
=
_srs_log
->
initialize
())
!=
ERROR_SUCCESS
)
{
...
...
请
注册
或
登录
后发表评论