mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-12 15:21:07 +02:00
Merge pull request #32 from TrurlMcByte/master
generate nessesary subfolders in play_local_path
This commit is contained in:
commit
b1e28ead5b
|
@ -485,6 +485,9 @@ ngx_rtmp_play_copy_local_file(ngx_rtmp_session_t *s, u_char *name)
|
|||
ngx_rtmp_play_ctx_t *ctx;
|
||||
u_char *path, *p;
|
||||
static u_char dpath[NGX_MAX_PATH + 1];
|
||||
u_char *d;
|
||||
static u_char dir[NGX_MAX_PATH + 1];
|
||||
u_int l;
|
||||
|
||||
pacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_play_module);
|
||||
if (pacf == NULL) {
|
||||
|
@ -500,6 +503,26 @@ ngx_rtmp_play_copy_local_file(ngx_rtmp_session_t *s, u_char *name)
|
|||
|
||||
p = ngx_snprintf(dpath, NGX_MAX_PATH, "%V/%s%V", &pacf->local_path,
|
||||
name + ctx->pfx_size, &ctx->sfx);
|
||||
|
||||
d = name + ctx->pfx_size;
|
||||
while (*d != '\0') {
|
||||
if (*d == '/') {
|
||||
p = ngx_snprintf(dir, NGX_MAX_PATH, "%V/%s", &pacf->local_path, name + ctx->pfx_size, &ctx->sfx);
|
||||
l = ngx_strlen(dir) - ngx_strlen(d);
|
||||
dir[l]='\0';
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||
"play: create dir '%s' for '%s'", dir, dpath);
|
||||
if (ngx_create_dir(dir, 0700) == NGX_FILE_ERROR) {
|
||||
if (ngx_errno != NGX_EEXIST) {
|
||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
|
||||
"play: error creating dir '%s' for '%s'", dir, dpath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
d++;
|
||||
}
|
||||
|
||||
*p = 0;
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||
|
|
Loading…
Reference in a new issue