Skip to content
Snippets Groups Projects
Commit af90e9d3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

If fail to create dirs.raw in lib parent dir, create in ctrl_dir instead

Fix for issue #809
parent 7dc93a67
No related branches found
No related tags found
No related merge requests found
Pipeline #7058 passed
...@@ -252,17 +252,20 @@ static void append_dir_list(const char* parent, const char* dir, FILE* fp, int d ...@@ -252,17 +252,20 @@ static void append_dir_list(const char* parent, const char* dir, FILE* fp, int d
globfree(&g); globfree(&g);
} }
BOOL create_raw_dir_list(const char* list_file) BOOL create_raw_dir_list(char* list_file)
{ {
char path[MAX_PATH+1]; char path[MAX_PATH+1];
char fname[MAX_PATH+1] = "dirs.raw";
char* p; char* p;
int k=0; int k=0;
bool include_empty_dirs; bool include_empty_dirs;
FILE* fp; FILE* fp;
SAFECOPY(path, list_file); SAFECOPY(path, list_file);
if((p=getfname(path))!=NULL) if((p=getfname(path))!=NULL) {
SAFECOPY(fname, p);
*p=0; *p=0;
}
if(uifc.input(WIN_MID|WIN_SAV,0,0,"Parent Directory",path,sizeof(path)-1 if(uifc.input(WIN_MID|WIN_SAV,0,0,"Parent Directory",path,sizeof(path)-1
,K_EDIT)<1) ,K_EDIT)<1)
return(FALSE); return(FALSE);
...@@ -275,11 +278,14 @@ BOOL create_raw_dir_list(const char* list_file) ...@@ -275,11 +278,14 @@ BOOL create_raw_dir_list(const char* list_file)
k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Recursive Directory Search",uifcYesNoOpts); k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Recursive Directory Search",uifcYesNoOpts);
if(k<0) if(k<0)
return(FALSE); return(FALSE);
if((fp=fopen(list_file,"w"))==NULL) {
strcpy(list_file, fname);
if((fp=fopen(list_file,"w"))==NULL) { if((fp=fopen(list_file,"w"))==NULL) {
SAFEPRINTF2(path,"Create Failure (%u): %s", errno, list_file); SAFEPRINTF2(path,"Create Failure (%u): %s", errno, list_file);
uifc.msg(path); uifc.msg(path);
return(FALSE); return(FALSE);
} }
}
backslash(path); backslash(path);
uifc.pop("Scanning Directories..."); uifc.pop("Scanning Directories...");
append_dir_list(path, path, fp, /* depth: */0, /* max_depth: */k, include_empty_dirs); append_dir_list(path, path, fp, /* depth: */0, /* max_depth: */k, include_empty_dirs);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment