Index: trunk/src/libpcb_fp.c =================================================================== --- trunk/src/libpcb_fp.c (revision 310) +++ trunk/src/libpcb_fp.c (revision 311) @@ -184,13 +184,8 @@ return 0; } - l = strlen(subdir); - memcpy(fn, subdir, l); - fn[l] = PCB_DIR_SEPARATOR_C; - fn_end = fn+l+1; - - /* Determine subdir is abs path */ + /* Determine subdir's abs path */ if (GetWorkingDirectory(subdir) == NULL) { Message(_("pcb_fp_list(): Could not determine new working directory\n")); if (chdir(olddir)) @@ -198,6 +193,11 @@ return 0; } + l = strlen(subdir); + memcpy(fn, subdir, l); + fn[l] = PCB_DIR_SEPARATOR_C; + fn_end = fn+l+1; + /* First try opening the directory specified by path */ if ((subdirobj = opendir(subdir)) == NULL) { OpendirErrorMessage(subdir);