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

Fix: initialize default data directories after auto-creating sub-dirs

When a file library's "Access to Sub-directories" option was enabled, any auto-created directories would have their data dir initialized as "blank" (empty), so their data files (e.g. <code>.dat, <code>.ixb) would be created in the ctrl directory.

I guess nobody used this feature? It is pretty cool, but not really documented. If you were using it before this commit, you'll need to move your sub-directories data files to data/dirs or re-add the files (recreate the database files). And you can remove the old cruft from the ctrl dir.
parent c90ba307
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1171 passed
......@@ -178,29 +178,6 @@ void prep_cfg(scfg_t* cfg)
prep_dir(cfg->ctrl_dir, cfg->lib[i]->parent_path, sizeof(cfg->lib[i]->parent_path));
}
for(i=0;i<cfg->total_dirs;i++) {
if(!cfg->dir[i]->data_dir[0]) /* no data storage path specified */
SAFEPRINTF(cfg->dir[i]->data_dir,"%sdirs",cfg->data_dir);
prep_dir(cfg->ctrl_dir, cfg->dir[i]->data_dir, sizeof(cfg->dir[i]->data_dir));
/* A directory's internal code is the combination of the lib's code_prefix & the dir's code_suffix */
SAFEPRINTF2(cfg->dir[i]->code,"%s%s"
,cfg->lib[cfg->dir[i]->lib]->code_prefix
,cfg->dir[i]->code_suffix);
strlwr(cfg->dir[i]->code); /* data filenames are all lowercase */
if(!cfg->dir[i]->path[0])
SAFECOPY(cfg->dir[i]->path, cfg->dir[i]->code);
if(cfg->lib[cfg->dir[i]->lib]->parent_path[0])
prep_dir(cfg->lib[cfg->dir[i]->lib]->parent_path, cfg->dir[i]->path, sizeof(cfg->dir[i]->path));
else
prep_dir(cfg->dir[i]->data_dir, cfg->dir[i]->path, sizeof(cfg->dir[i]->path));
prep_path(cfg->dir[i]->upload_sem);
}
for(i=0;i<cfg->total_libs;i++) {
if((cfg->lib[i]->misc&LIB_DIRS) == 0 || cfg->lib[i]->parent_path[0] == 0)
continue;
......@@ -255,6 +232,28 @@ void prep_cfg(scfg_t* cfg)
}
}
for(i=0;i<cfg->total_dirs;i++) {
if(!cfg->dir[i]->data_dir[0]) /* no data storage path specified */
SAFEPRINTF(cfg->dir[i]->data_dir,"%sdirs",cfg->data_dir);
prep_dir(cfg->ctrl_dir, cfg->dir[i]->data_dir, sizeof(cfg->dir[i]->data_dir));
/* A directory's internal code is the combination of the lib's code_prefix & the dir's code_suffix */
SAFEPRINTF2(cfg->dir[i]->code,"%s%s"
,cfg->lib[cfg->dir[i]->lib]->code_prefix
,cfg->dir[i]->code_suffix);
strlwr(cfg->dir[i]->code); /* data filenames are all lowercase */
if(!cfg->dir[i]->path[0])
SAFECOPY(cfg->dir[i]->path, cfg->dir[i]->code);
if(cfg->lib[cfg->dir[i]->lib]->parent_path[0])
prep_dir(cfg->lib[cfg->dir[i]->lib]->parent_path, cfg->dir[i]->path, sizeof(cfg->dir[i]->path));
else
prep_dir(cfg->dir[i]->data_dir, cfg->dir[i]->path, sizeof(cfg->dir[i]->path));
prep_path(cfg->dir[i]->upload_sem);
}
/* make data filenames are all lowercase */
for(i=0;i<cfg->total_shells;i++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment