- char *bp = strrchr(path, '/');
- if( !bp ) bp = path; else ++bp;
- char *sp = strrchr(bp,'.');
- if( !sp ) sp = bp + strlen(bp);
- char *cp = png_path, *dp = bp;
- cp += sprintf(cp,"%s/%s/", mwindow->preferences->plugin_dir, theme_dir);
- while( dp < sp ) *cp++ = *dp++;
- strcpy(cp, ".png");
- struct stat st;
- if( stat(png_path, &st) ) return 0;
- if( !S_ISREG(st.st_mode) ) return 0;
- if( st.st_size == 0 ) return 0;
- return st.st_size;
+ char *pp = png_name, *ep = pp + BCSTRLEN-1;
+ char *cp = strrchr(path, '/');
+ cp = !cp ? path : cp+1;
+ char *sp = strrchr(cp, '.');
+ if( !sp ) sp = cp+strlen(cp);
+ while( pp < ep && cp < sp ) *pp++ = *cp++;
+ snprintf(pp, ep-pp, ".png");