void make_path(const char * parent,const char * filename,const char * extension,bool allow_new_dirs,pfc::string8 & out,bool really_create_dirs,abort_callback & p_abort)
{
    out.reset();
    if (parent && *parent)
    {
        out = parent;
        out.fix_dir_separator('\\');
    }
    bool last_char_is_dir_sep = true;
    while(*filename)
    {
#ifdef WIN32
        if (allow_new_dirs && is_bad_dirchar(*filename))
        {
            const char * ptr = filename+1;
            while(is_bad_dirchar(*ptr)) ptr++;
            if (*ptr!='\\' && *ptr!='/') out.add_string(filename,ptr-filename);
            filename = ptr;
            if (*filename==0) break;
        }
#endif
        if (pfc::is_path_bad_char(*filename))
        {
            if (allow_new_dirs && (*filename=='\\' || *filename=='/'))
            {
                if (!last_char_is_dir_sep)
                {
                    if (really_create_dirs) try {
                            filesystem::g_create_directory(out,p_abort);
                        }
                        catch(exception_io_already_exists) {}
                    out.add_char('\\');
                    last_char_is_dir_sep = true;
                }
            }
            else
                out.add_char('_');
        }
        else
        {
            out.add_byte(*filename);
            last_char_is_dir_sep = false;
        }
        filename++;
    }
    if (out.length()>0 && out[out.length()-1]=='\\')
    {
        out.add_string("noname");
    }
    if (extension && *extension)
    {
        out.add_char('.');
        out.add_string(extension);
    }
}
Beispiel #2
0
	void update()
	{
		pfc::string8 title;
		if ( path.length() )
		{
			title = pfc::string_filename_ext( path );
			title += " - ";
		}
		title += "DUMB";
		uSetWindowText( wnd, title );

		BOOL enable = song_renderer != 0 && cfg_control_override;

		HWND w;
		for ( unsigned i = 0; i < DUMB_IT_N_CHANNELS; ++i )
		{
			w = GetDlgItem( wnd, IDC_VOICE1 + i );
			uSendMessage( w, BM_SETCHECK, ! ( ( mute_mask >> i ) & 1 ) , 0 );
			EnableWindow( w, enable );
			ShowWindow( w, ( ( t_uint64(1) << i ) & channels_allowed ) ? SW_SHOWNA : SW_HIDE );
		}
	}