Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 4452) +++ trunk/src/plug_io.c (revision 4453) @@ -692,6 +692,31 @@ gds_append_str(s, (PCB->Filename != NULL) ? PCB->Filename : "no_file_name"); (*input)++; return 0; + case 'B': + if (PCB->Filename != NULL) { + char *bn = strrchr(PCB->Filename, '/'); + if (bn != NULL) + bn++; + else + bn = PCB->Filename; + gds_append_str(s, bn); + } + else + gds_append_str(s, "no_file_name"); + (*input)++; + return 0; + case 'D': + if (PCB->Filename != NULL) { + char *bn = strrchr(PCB->Filename, '/'); + if (bn != NULL) + gds_append_len(s, PCB->Filename, bn-PCB->Filename+1); + else + gds_append_str(s, "./"); + } + else + gds_append_str(s, "./"); + (*input)++; + return 0; case 'N': gds_append_str(s, (PCB->Name != NULL) ? PCB->Name : "no_name"); (*input)++; Index: trunk/src/plug_io.h =================================================================== --- trunk/src/plug_io.h (revision 4452) +++ trunk/src/plug_io.h (revision 4453) @@ -150,6 +150,8 @@ /* generic file name template substitution callbacks for pcb_strdup_subst: %P pid %F load-time file name of the current pcb + %B basename (load-time file name of the current pcb without path) + %D dirname (load-time file path of the current pcb, without file name, with trailing slash, might be ./) %N name of the current pcb %T wall time (Epoch) */