X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fproxy.C;h=edeb394ac0fe4d61595045117dfd8b4cb5500289;hp=3165ad0ec8c3ced9724e486bb69e2ff6f1854d86;hb=dcaa99e024dc4eac8e22e94ca6c0a92d67570478;hpb=c1215e4fe370c818f83a8250475cb18cec69cc66 diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index 3165ad0e..edeb394a 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -195,7 +195,16 @@ void ProxyRender::to_proxy_path(char *new_path, Indexable *indexable, int scale) { // path is already a proxy if( strstr(indexable->path, ".proxy") ) return; - strcpy(new_path, indexable->path); + if( !indexable->is_asset ) { + char *ifn = indexable->path, *cp = strrchr(ifn, '/'); + if( cp ) ifn = cp+1; + char proxy_path[BCTEXTLEN]; + File::getenv_path(proxy_path, + mwindow->preferences->nested_proxy_path); + sprintf(new_path, "%s/%s", proxy_path, ifn); + } + else + strcpy(new_path, indexable->path); char prxy[BCSTRLEN]; int n = sprintf(prxy, ".proxy%d", scale); // insert proxy, path.sfx => path.proxy#-sfx.ext @@ -265,8 +274,18 @@ Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale) if( strstr(idxbl->path,".proxy") ) return 0; char new_path[BCTEXTLEN]; to_proxy_path(new_path, idxbl, new_scale); -// don't proxy if not readable +// don't proxy if not readable, or proxy_path not writable if( idxbl->is_asset && access(idxbl->path, R_OK) ) return 0; + int ret = access(new_path, W_OK); + if( ret ) { + int fd = ::open(new_path,O_WRONLY); + if( fd < 0 ) fd = open(new_path,O_WRONLY+O_CREAT,0666); + if( fd >= 0 ) { close(fd); ret = 0; } + } + if( ret ) { + eprintf(_("bad proxy path: %s\n"), new_path); + return 0; + } // add to orig_idxbls & orig_proxies if it isn't already there. int got_it = 0; for( int i = 0; !got_it && i